I'm using jQuery's AJAX function, like so:

    $.ajax ({ "url" : "/note",
         "async" : true,
         "type" : "POST",
         "data" : {"id" : id, "content" : el.value}
       });

On the backend (Python Google App Engine, currently using 
webapp.RequestHandler), PUT requests are handled by the same function that 
handles POST requests.

If I make a POST request everything works. If I change it to a PUT request 
(by changing type of the AJAX call), nothing works. If I check the logs for 
GAE, I see:

    BadKeyError: Invalid string key .

This is the result of logging the ID for each call:

    ID: 
ahFkZXZ-YXp2ZC13ZWJub3Rlc3ItCxIKU3RpY2t5Tm90ZSIQdGVzdEBleGFtcGxlLmNvbQwLEgdzbk1vZGVsGAIM
 
(from the POST call)
    ID: (from the PUT call)

So clearly it's not passing the ID properly for PUT calls, which is why the 
datastore is giving me a BadKeyError. I'm not sure if this is a problem on 
jQuery's side, or if it's from GAE's side, though, and I have no idea what's 
going on. Any help would be appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/z__ZZGXZAIwJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to