• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ajax JSON looping in jQuery

 
Tarik Ansari
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64992
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no need to parse the JSON, it should be in JSON already.

Eric


 
Tarik Ansari
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64992
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic