Advertisement

05.16.2008 at 03:13AM PDT, ID: 23407794
[x]
Attachment Details

Syncronous AJAX (SJAX) in Firefox not working

Asked by comcar in Asynchronous Javascript and XML (AJAX), JavaScript, Firefox Web Browser

Tags: Javascript, AJAX, Firefox 2, http://www.comcar.co.uk/newcar/companycar/widget/VED/index.html

I can't get Firefox to wait for an AJAX XMLHttpRequest to load before continuing with the rest of my Javascript. I've set the 3rd parameter of the .open() method to "false" to make it syncronous and it works fine in IE, but I've read that Firefox will ignore this and not monitor ".onreadystatechange".

I've tried using an IF statement after .open() and .send() to check if ".onreadystatechange" is NULL and then forcing the reponse text into a variable, but this doens't seem to work either.

I can see the repsonse is eventaully loading using Firebug but a method further down the code attempts to update the contents of a DIV in this responsetext, and it says the DIV doesn't exist, because the method is being called before the AJAX loads the response text!

Please help! I've been working on this project for far too long and I want to be rid of it!

Thanks,

PeteStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
// This is the check in after the AJAX call, from a method called "loadDiv()"
 
xmlhttp.open("GET", url, sync);
xmlhttp.send(null);
 try {
  if(xmlhttp.obj.onreadystatechange == null)
   if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
    document.getElementById(content).innerHTML = xmlhttp.responseText;
   }
 }catch (e){}
 
...
 
// And here's an example of where it fails
 
...
loadDiv(url,'hiddenVals', 'false');
carJSON.carID = document.getElementById('carId').value;
...
 
// With the "carId" element being returned in the responsetext from "loadDiv()".
 
Loading Advertisement...
 
[+][-]05.16.2008 at 04:05AM PDT, ID: 21581696

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.16.2008 at 04:06AM PDT, ID: 21581708

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.16.2008 at 04:26AM PDT, ID: 21581780

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.16.2008 at 04:37AM PDT, ID: 21581814

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.16.2008 at 05:42AM PDT, ID: 21582145

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.16.2008 at 06:00AM PDT, ID: 21582270

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Asynchronous Javascript and XML (AJAX), JavaScript, Firefox Web Browser
Sign Up Now!
Solution Provided By: JohnSixkiller
Participating Experts: 2
Solution Grade: B
 
 
[+][-]05.16.2008 at 06:01AM PDT, ID: 21582278

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.16.2008 at 07:10AM PDT, ID: 21582806

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.16.2008 at 08:04AM PDT, ID: 21583363

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.18.2008 at 11:20PM PDT, ID: 21595511

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628