View Single Post
Old 08-09-2010, 03:28 PM   PM User | #7
Spudhead
Senior Coder

 
Spudhead's Avatar
 
Join Date: Jun 2002
Location: London, UK
Posts: 1,856
Thanks: 8
Thanked 110 Times in 109 Posts
Spudhead is on a distinguished road
Hi. Two things:

1. Don't paste questions onto the end of existing threads. It makes stuff hard to find. And nobody will see your question.

2. You need to rethink your code structure. Your function is firing an an asynchronous request: by the time the request returns, your function has completed.

It's a little hard to say what to do without seeing your full code, but I think you've got two options. One is - whatever these arrays of data are, think about expanding them globally to store the results of successive ajax calls. But that might not be too economical, and in any case you're still going to have to fire something when the ajax completes, to let your application know the data has been updated: in effect, you've not solved the problem, you've just pushed it downstream a bit. The other approach is to do a synchronous http request, but that'll only work if you're calling a url on the same domain as the originating page.

Sorry, that was a bit rambly. Post your code and we might be able to work out a solution. But start another thread for it.
Spudhead is offline   Reply With Quote