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 google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to