How to use jQuery to load json data through Ajax request?
In Java you can use the following code to crate the json response:
JSONObject obj=new JSONObject();
obj.put("name","foo"); obj.put("num",new Integer(100)); obj.put("balance",new Double(1000.21)); obj.put("is_vip",new Boolean(true)); obj.put("nickname","sada"); out.print(obj); out.flush();
and the use
jQuery.getJSON( url, [ data ], [ callback(data, textStatus, xhr) ] )
at client side to process the json data.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.