javascript - Pass JSON object to Python Script -


I want to pass the form {key: value} to a JSON object which contains several elements of the Python script. Because I am able to send the JSON object from I can see that in Ajax function in the response variable in success.

I am using the CDI. FieldStorage () to get post data I want to exceed the received JSON object elements and store the value and value in the variable. Later, I want to use those variables in the printing of HTML via that python script. I do not know how to proceed and repeat

You cgi.FieldStorage Do not require, just read stdin:

  import system import json data = json.load (sys.stdin)   

on the client side, Data must be converted manually by a Jason-string:

  $. Ajax ({url: "/city/cgi-bin/test1.py", type: "post", type of content: "app / jason; charset = utf-8", data type: "jason", data: JSON. Stringify ({'lat': 30.5, 'law': 4.5}), success: function (feedback) {//window.location="http:// mycity.parseapp.com/city/cgi-bin/test1.py "Console.log (response.message); console.log (response.keys); console.log (response.data);}});    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -