I have the following problem:
I am working on a flash application and I want to transfer some data to the server via AJAX. I am new to this AJAX job, so I can't get anything like that.
On my client side, when the user clicks on the icon, I want to pass some data through jQuery.post stored in the variable message:
jQuery("#icon_ID").click(function() { var message = { 'GRAPH_TYPE': graphType }; var _sendOnSuccess = function () { } var jqxhr = jQuery.post('/graph', message, _sendOnSuccess, 'json'); });
On my server side, I have the following code:
@app.route('/graph', methods = ['POST']) @login_required def physical_graph(): ret_data = request.form['GRAPH_TYPE'] return ""
All I want to do now is access the server side GRAPH_TYPE. However, when I click on the icon, I get an error message:
Method not allowed
The GET method is not allowed for the requested URL.
I really don't understand why Python tells me that I use the GET method, when in fact I use the POST method.
Can anyone help me with this? What should I do to solve this problem? If there is any other method that I can use, feel free to give me any advice. Just keep in mind that besides jQuery, I don't want to use another JavaScript library.
Thank you in advance!
source share