That did the trick, I love you man! :O) Now, how would I perform the same with a POST if I needed to?
-Rob On May 4, 2:07 am, Stephan Hartmann <[email protected]> wrote: > if you want to get your data as request parameter, you should use "GET" > instead of "POST" and /or let the default contentType > "application/x-www-form-urlencoded" and create your json object as either > > var json = {name: "test"}; // and let jquery convert it to a query > string > or > var json = "name=test"; // the desired query string > > regards, > Stephan > > 2010/5/4 Rob <[email protected]> > > > > > > > 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]<google-appengine-java%2B > > [email protected]> > > . > > For more options, visit this group at > >http://groups.google.com/group/google-appengine-java?hl=en. > > -- > 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 > athttp://groups.google.com/group/google-appengine-java?hl=en. -- 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.
