Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Problem with jQuery and multiple ajax calls

New Here ,
Jun 04, 2008 Jun 04, 2008
I've noticed an off and on problem with ColdFusion/jQuery and multiple Ajax requests. The set up is fairly straight forward. I'm using CF 8 with the updater, and the latest stable version of jQuery. I have a function that is called when a combo box value is changed. When the combo box value is changed, two ajax requests are called to update other parts of the page.

If I run each of those requests manually, then there is no problem. However, I'll notice that they do not work about 30% of the time. Either ajax request can fail, so it's not specific to one call. I'm running Firebug and the errors that are reported from CF are unusual. Basically, CF thinks that a application variable is undefined. However, if I trap the failure and dump the application scope, it's always there. The actual application variable that is reported as undefined seems to be fairly random.

Has anyone else experienced any problems like this? If I take the same (ajax) request and run manually - it never fails. If I reload the page and try the same process again, it will work 70% of the time.

The requests look completely normal in Firebug, so I can't think of any reason why the calls would fail in one instance and not the other. And certainly not as random as it appears to be now.

Thanks!
Mike
TOPICS
Advanced techniques
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 04, 2008 Jun 04, 2008
Just wanted to make sure that the parent post is clear that this is only a problem when there are multiple ajax requests at once. They are serial and not parallel, but I've never gotten this problem when I take out one of the ajax calls (doesn't matter which one).
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 04, 2008 Jun 04, 2008
care to post some code to help replicate the problem?

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 04, 2008 Jun 04, 2008
LATEST
I attached jquery code that seems to be the problem:

One of those two requests will fail (as reported by Firebug). I have gotten around it by putting the second ajax call in the complete attribute of the first jquery call, but I can't understand why this problem occurs. I'm starting to think that this is because the two requests are submitted and handled incorrectly. But why would CF report an application error?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources