Cherrypy - Reciving Json Data 404, 'missing Parameters'
I'm making my own site from scratch using Cherrypy Postgresql. I am a beginner with Python and Javascript but I am very enthusiastic about learning those two programming languages.
Solution 1:
The AJAX data you'll receive in in your login
function is not contained in the parameter dataString
(actually, you will not get any parameter) but in cherrypy.request.json
.
Thus you should change your login function as follows:
@cherrypy.expose
@cherrypy.tools.json_in()
def login(self):
json_obj = cherrypy.request.json
...
Note that you will receive an actual object (dict / list) based on the AJAX parameters, not a string.
Another note: cherrypy.request.json
is only filled if you've set the decorator @cherrypy.tools.json_in()
(as you already did).
Post a Comment for "Cherrypy - Reciving Json Data 404, 'missing Parameters'"