Closed
Bug 675182
Opened 13 years ago
Closed 13 years ago
Ajax callback functions do not update a global javascript variable
Categories
(Firefox :: General, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 637264
People
(Reporter: peter.sheldon, Unassigned)
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0 Build ID: 20110615151330 Steps to reproduce: I have a page which uses Javascript. It contains 2 ajax callback functions which try to update a global variable. The global variable is never modified in Firefox 5.0. Actual results: The global variable is not updated when this code runs in Firefox 5 It works in IE8, Safari 4.0.4 and Opera 10.63 Expected results: The global variable should be updated so that when the second callback method is called it does not have the default value of 2.
Do you have a site where this happens? Cause the .js file isn't enough to test this.
Reporter | ||
Comment 2•13 years ago
|
||
See http://www.hertsdirect.org/your-community/?results=true&q=Stevenage
Reporter | ||
Comment 3•13 years ago
|
||
...That was where the problem was identified
Reporter | ||
Comment 4•13 years ago
|
||
I can probably a more precise example by later on this afternoon
Reporter | ||
Comment 5•13 years ago
|
||
This is a far better example file. Unfortunately I do not have a live example url yet however I believe that the actual paths in the callback function are irrelevant to recreating the problem I am seeing this bug on a page which includes: <script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script>
Reporter | ||
Comment 6•13 years ago
|
||
Since I have now found a work around for my particular problem, I will just summarise by saying that currently in Firefox 5 it does not seem possible to update the value of a global variable inside a callback function, and then use that updated value within a different callback method.
Ok, what your seeing is bug 637264, and it has nothing to do with global variables. What happens is: 1. ajax call A happens 2. ajax call B happens 3. callback alert A happens 4. callback alert B happens 5. global variable is set in callback A 6. global variable is set in callback b 7. global variable is reset in the complete callbacks x 2 Note though that if you remove the alerts you would get these race problems in more browsers then firefox.
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•