ajax.status not working with firefox 6 - always returns status 0. This feature is basic, was working with firefox 5. What have you done and how can I make my website work again with ajax?
I am developing websites using ajax. With firefox 6 ajax.status is only returning 0 not 200. I have not changed my code. It works with earlier versions of Firefox and with Chrome 13. I have defined a javascript variable ajax1 at beginning of program, typical procedure.
function ajaxFunction(){ var ajaxRequest; // The variable that makes Ajax possible!
if (window.XMLHttpRequest) { // IE 7, Mozilla, Safari, Firefox, Opera, most browsers:
ajaxRequest = new XMLHttpRequest();
} else if (window.ActiveXObject) { // Older IE browsers // Create type Msxml2.XMLHTTP, if possible:
try { ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e1) { // Create the older type instead: try { ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e2) { } } } // Send an alert if the object wasn't created. if (!ajaxRequest) { alert ('Some page functionality is unavailable.'); } else {
return ajaxRequest; }
var ajax1 = ajaxFunction(); var ajax2 = ajaxFunction();
This code below does not not work because firefox 6.02 is not returning anything but 0 for the status: if (ajax1.readyState == 4) && (ajax1.status == 200){
You have done something with your javascript engine that is causing this problem. How can I get ajax to work using post method - am using code like this which WAS working in earlier versions of firefox:
var post_data = 'email=' + encodeURIComponent(email); ajax1.open('post', 'check_4_company.php',true); ajax1.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); ajax1.onreadystatechange = handle_mope; ajax1.send(post_data); return false;
This code is very basic, have used it hundreds if not thousands of times successfully!
But firefox 6 has messed things up!
Please advise!
jimfre bacal
Tất cả các câu trả lời (1)
Further discussion here: ajax problems with firefox 6 at mozillaZine Forums