wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Ajax JSON looping in jQuery Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Ajax JSON looping in jQuery" Watch "Ajax JSON looping in jQuery" New topic
Author

Ajax JSON looping in jQuery

Tarik Ansari
Ranch Hand

Joined: Dec 31, 2008
Posts: 50
Hi All,

I am new to jQuery, could you please let me know how do i loop the below JSON and display result in success of AJAX (Result appended in a div)

JSON format


Below AJAX method


Any leads on how to loop and display the JSON object would be appreciated.

Thanks
Tarik
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

Tarik Ansari wrote:Any leads would be appreciated.

Any leads on what? What's the problem?

Also, please edit your post to properly indent the JavaScript code. Unformatted/unindented code is harder to read.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
There is no need to parse the JSON, it should be in JSON already.

Eric


Tarik Ansari
Ranch Hand

Joined: Dec 31, 2008
Posts: 50
Eric, JSON is already available, i need to know how to loop the result of the JSON (Say for loop JSON object and pull the value)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

Once it's been evaluated, it's no longer JSON. JSON is the serialized text format; after evaluation, it's just a JavaScript object like any other.

As it's not any array, why the need to "loop"? Are are you trying to iterate over the properties rather than directly address them?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ajax JSON looping in jQuery
 
Similar Threads
problem in json/ajax
Pass JSON object from server to jQuery and loop on the object
JSON response into HTML
JQuery Autocomplete with ASP.Net webservice
struts2 (2.1.8.1) json result type problems