• 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Nested , concurrent ajax requests

 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi I have two questions about ajax processing
(1) When a radio (choice) button is clicked, I set values in two fields, and these two fields 'onchange' fire ajax requests. Now does these two ajax requests execute as two different threads without any collision?


(2) When a radio (choice) button is clicked, I set value in a field, and this onchange fires an ajax request, on the response it sets three fields. The first of these three fires another ajax request. Does the second request interrupts the completion of the first response (if it hasn't set the 2nd and 3rd fields yet) or they execute independetly.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It all depends on how you code the XMLHttpRequest object. If they ar OO without using any of the same variables, than it is fine. If you use the same global variables, you will have issues.

Eric
 
Sheriff
Posts: 67595
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use of a library such as jQuery or Prototype helps to keep your Ajax code free of global variables.

For example with jQuery, to fire off an Ajax request to load an element with the result upon a click handler:



Not a global variable in sight. (And yes, that's all there is to it).
[ November 09, 2007: Message edited by: Bear Bibeault ]
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic