Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ajax synchronicity?

 
graham king
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using ajax to populate some combo boxes. Each relies on the other values. I found one box value could be used to populate two boxes. However, it appeared that the two calls overlapped and the resulting boxes where populated with the second finishing ajax call.

Wasn't there a way to make an ajax call block other javascript calls until it had finished what it was doing? Just for kicks: How 2 do it?

HELP PLEASES What am I missing?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You look at the true/false argument in the open method.

It would be better to code it so you would not run into this problem. OO JavaScript is the way to go.

Eric
 
graham king
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Eric Pascarello:

It would be better to code it so you would not run into this problem. OO JavaScript is the way to go.


Eric, is there anyway you could give me an example of this?

raying:

Graham
 
graham king
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Need a refresher on the whole JavaScript paradigm. I had forgotten that a variable declared without the var signa automatically becomes a global variable. So, the onchange event was actually using the same request object and terminating with wichever finished first. Silly me. By changing the name of the declared variable I was able to get the desired results.




[ December 01, 2006: Message edited by: graham king ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic