For a POST request, use json.loads(self.request.body). Arguments to post() are extracted from the url regex.
post data from ember js to python
-
18-06-2023 - |
Frage
iam using ember js with python and tornado server.
I want to send the json data from ember js to python.
here is what i have tried
App.MyleavesController = Ember.ObjectController.extend({
submitAction: function () {
data=[{fromdate:this.get("model.fromdate")}]
$.ajax({
type: "POST",
url: "/apply_leave",
data: JSON.stringify(data),
success: function ( data ) {
}
});
}
});
in my python it is
class LeaveFormHandler(tornado.web.RequestHandler):
def post(self):
print json.loads(data)
but i could not get data..
it says " global name 'data' is not defined"
am a newbie please help..
Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow