dimanche 20 avril 2014

Q: Python, Cherrypy check if a JSON form was sent


Vote count:

0




how can i check if my form was sent, its ajax/json



function save_formular() {
var values = $$("form_elements").getValues();
webix.ajax().header({
"Content-type":"application/json"
}).post("/create", JSON.stringify(values), function() {
document.getElementById("content").innerHTML="<div>OK!</div>";
});
}


im stuck in my python method create:



def create(self):

# i want to check first if the form was sent
data = cherrypy.request.json # error
# AttributeError: 'Request' object has no attribute 'json'

return sometext
create.exposed = True


is there another easy way to get these ajax values?



asked 45 secs ago






Aucun commentaire:

Enregistrer un commentaire