How do I pass a PlainObject to a Java servlet with JQuery.get?
-
My script looks something like: var x = {value: { json: $('#field1').val()}}; $.get('/myservlet', x, function(responseJson) { ....}}); And on the server side: doGet(HttpServletRequest req, HttpServletResponse response){ String zz = req.getParameter("value"); ... When I set x to something straightforward (e.g x = {value, "my value"}), it works. But as above, I get z==null. I expected, I dunno, maybe the JSON text or something. I thought jQuery said that I could pass a PlainObject. Does this not count? Or is there something I should be using other than getParameter?
-
Answer:
I don't think there should be a problem. Check if the JSON object you are passing is correct. and also see if the object was sent to server or no.
Gourav Agarwal at Quora Visit the source
Related Q & A:
- How can I make a Spinner only by java?Best solution by stackoverflow.com
- How do I do a HTTP GET in Java (android?Best solution by Stack Overflow
- How can I pass global variables into a function?Best solution by Stack Overflow
- How do I get a value from a JObject?Best solution by Stack Overflow
- How do I get a sponsor for a charity marathon?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.