• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

JSON with Ajax.

 
Ranch Hand
Posts: 419
Mac jQuery Objective C
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have a JsonArray of JSONObjects each object is basically filled with a node of XML. so for example:

JSONObject a = new JSONObject(); will have following properties id, parentId and name. Now I am creating a json array of these JSONObjects and sending it in request object. In my jsp using javascript I am iterating through that JSONArray and creating a javascript custom object which is basically used to display a tree structure on jsp page as shown in the attachment. Now If the length of json array is quite big, let us say it contains 1000 JSONObjects in that case my script takes alot of time and even I get error on the browser saying that "Script is taking alot of time do you want to continue?". Now to recover this problem I was thinking of using AJAX. So What I was thinking that suppose as shown in the attachment when user will click on Node 1 to open it ajax will make an asynchronous call to server's method by passing id of Node 1 and fetch all of it's children(as each node has it's parent's id) in a json array and then iterate through that array and create javascript custom objects and display them under tree. Is this idea correct? If yes can anyone suggest me how much time this will take to perform above action? And if no then suggest me some ideas to perform the above task.
tree.jpg
[Thumbnail for tree.jpg]
tree structure to be displayed
 
pawan chopra
Ranch Hand
Posts: 419
Mac jQuery Objective C
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can any body please help on this?
 
I hired a bunch of ninjas. The fridge is empty, but I can't find them to tell them the mission.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic