Skip to content
Advertisement

How do I pass inputs from jQuery to Flask?

I have three inputs I am trying to pass the values back to a function inside my app, from the index.html rendered in Flask.

Here are the inputs:

JavaScript

Here is the script to assign and render their values on the page (for Rate and Percent of income sliders) as well as my start at trying to pass the values.

JavaScript

Here is the route I have started that I am trying to pass values / request values from but I am a bit stuck, new to jQuery and I am getting 404 errors when I change the values. Running in loops trying to parse what’s happening and not. Any advice appreciated!

JavaScript

Advertisement

Answer

To fetch a value from an input field using JQuery, try the following: $('#{Id_of_input_field}').val()

In your example it will look something like:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement