[RESOLVED] Ajax & Firefox problem
So I want a form that is submitted with ajax. What I have so far works fine in IE but not in Firefox. Heres my code:
Code:
//Sends Sign-Up Form
function sendsuf(){
var ajaxRequest;
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
alert(ajaxRequest.responseText);
}
}
// I think the problem is somewhere below this line
ajaxRequest.open('POST', 'adduser.php', true);
ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
ajaxRequest.setRequestHeader("Content-length", params.length);
ajaxRequest.setRequestHeader("Connection", "close");
var fullname = document.getElementById('fullname').value;
var email = document.getElementById('email').value;
ajaxRequest.send('fullname=' + fullname + '&email=' + email);
}
Any ideas?
Thanks