Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Parallel requests using AJAX

 
Ashutosh Arya
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to call AJAX response in another AJAX call..but when I give some alerts only then it behaves in sequence otherwise not.

Please help me that how can make it to work in sequence.

Thanks in advance.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you ask that again, perhaps with a code sample (please UseCodeTags)? I don't understand what you're asking.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Build a queue system.

Eric
 
Ashutosh Arya
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have almost achieved what I wanted, but a small issue is when I am hitting the submit button and calling a function which in turn calls two ajax function the submit button dosent come back unless the calls are complete and remain pressed and the loading image is also not displayed. Below is the code:


If I give any alert message and haulting the process the loading image is displayed but as I click on ok of the alert again the system respondes only when all the calls are complete
Please let me know how can I display the loading Image in this scenario.

I have tried all but still as I press submit the button remains pressed until all the calls gets complted.It gives a feeling as the page is stuck which I dont want!

Please help

Thanks in advance

Aashu
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
font tags are depreciated. You should never use them.

Eric
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should never use eval like that.

eJD = eval("verForm.jD"+i);

var foo = document.formName.elements["elemName" + yourVariable];


Eric
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are making a sychronous call. It will lock up the browser and not allow anything else to happen. That is why your image is not loading.

Eric
 
Ashutosh Arya
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Eric,

I will surely implement the changes but as far as Synchronous call is concerned I have to use that as when I am not using that the assingment to the global variable is not happening properly (as the calls are async) so I used it but still when I tried with async calls, when i press submit, the button is staying pressed until all the calls complete.

I have mentioned that when I stop the process by giving an alert in between anywhere in these methods the loading image is displaying.

Actually what is happening is when the submit button comes back from calls it quickly places both the images one after the other which finally shows successfully updated message.

That's a tricky thing I am unable to solve.

If you notice the function which is initially called is not an AJAX function, Is that making the difference? (As when I was using an AJAX function earlier the loading image was working fine)

Any suggestions?

Aashu
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic