View Single Post
Old 10-02-2012, 07:47 AM   PM User | #1
Daniel Evans
New to the CF scene

 
Join Date: Aug 2010
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
Daniel Evans is an unknown quantity at this point
Multi-step AJAX process?

Hi,

the general concept and basic use of AJAX is something which I understand just fine, but now I have come upon an issue that's proving to be troublesome. Here's what is needed:
  • The first call to a .php-file returns a variable number of tasks which need to be worked through.
  • Each task may or may not have a variable number of sub-tasks which I can only know after its xml-data has been received.
  • This must all be done in the proper order, like: task 1, task 2, task 2 sub 1, task 2 sub 2, task 2 sub 3, task 3, task 4, task 4 sub 1, etc.
  • It needs only be compatible to Webkit/Chrome/Chromium, jQuery is available.

Now, here is my main problem: I have no idea how to best implement something like this.

My first thought was to create two loops, one for the main list and a second which will be fired every time there's a list of sub-tasks in the result. For all of that to work properly, I'd need to use synchronous calls. The end-users will access this via the Internet and the .php-files may take a second or two since there is a lot of work done server-side. Will a longer execution time be an issue?

Is that a workable concept or are there better ways? I don't need or expect a finished product, but I would appreciate some general help or, if possible, a link to some code with a similar concept, so I can learn it on the way.
Daniel Evans is offline   Reply With Quote