I'm running Google App Engine through IntelliJ Idea and am posting
data to a Servlet using jQuery.ajax. I'm hitting the Servlet without
issue and can return data in the response, however, the request
parameters are always null; I cant seem to POST data. Where am I going
wrong?
var json = JSON2.stringify({name: "test"});
$.ajax({
type: "POST",
url: service,
data: json,
contentType: "application/json; charset=utf-8",
dataType: "json",
async: async,
success: function(o) {
o = $.serviceHelper.jsonSerialize(o);
callback(o);
},
error: this.dataServiceError
});
protected void doPost(javax.servlet.http.HttpServletRequest
request, javax.servlet.http.HttpServletResponse response) throws
javax.servlet.ServletException, IOException {
PrintWriter out = response.getWriter();
response.setContentType("text/json");
String json = gson.toJson(request.getParameter("name"));
out.println(json);
}
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
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-java?hl=en.