javascript - flask / apache: serialized data not getting passed to Flask endpoint -


have complicated endpoint in flask deployed server running application under apache:

@app.route('/whatever', methods=['get', 'post']) def somefunct:     if request.method == 'post':         templist = request.data.split("=", 1)         << stuff templist >>      << other stuff >>     return render_template('sometemplate.html', **<<variable dict>>) 

sometemplate.html kind of tricky, contains table pulls data variable dictionary , provides dropdown allows user interact it, leveraging jinja variables:

{% item in << variable in dict >> %}  ...  <td>     <form name="category-form" id="category-form-{{ item }}" action="/whatever">         <select name="{{ item }}" id="{{ item }}">             <option value="1">option 1</option>             <option value="2">option 2</option>             <option value="3">option 3</option>         </select>     </form> </td> 

and have javascript trigger right post action (jquery loaded):

$(document).ready(function() {     {% item in << variable in dict >> %}      var form{{ item }} = $('category-form-{{ item }}');      form{{ item }}.find('#{{ item }}').change(function(){         $.ajax({             type: "post",             url: form{{ item }}.attr('action'),             data: form{{ item }}.serialize(),             success: function(response){                 console.log("calling {{item}}")             }         });     });      {% endfor %} }); 

i've done testing , can see whenever item's form called, sending post action correct endpoint.

i can see serializing right object, i.e. 319832=2.

for reason, serialized object not getting passed endpoint correctly -- templist empty object in flask.

guessing handshake between ajax call , receipt of request endpoint. ideas why endpoint might not receiving request in apache context, while above works on localhost?


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -