ok, hello all.. it's my first time in this forum, i was looking for a webmasters forum and i found this in google~ so.. let me start !
a small question about Ajax / HttpRequest in mozilla
i have my httprequest script working on Internet Explorer, using POST method and other using GET Method
the GET httprequest works fine in Mozilla/IE
BUT, using the POST method in Mozilla doesn't work, it works fine using IE not mozilla firefox.
testing the script, and trying to find out why it doesn't work
i found that the problem was here:
Code:
var parameters = "aemail=" + escape(document.getElementById("aemail").value ) +
"&alogin=" + escape(document.getElementById("alogin").value ) +
"&apassword=" + escape(document.getElementById("apassword").value ) +
"&newPass=" + escape(document.getElementById("newPass").value ) +
"&confirmPass=" + escape(document.getElementById("confirmPass").value );
i dont know what the problem is, because that works fine using internet explorer
this is my complete script
Code:
var xmlHttp
function goPost(module,section,method)
{
xmlHttp = false;
xmlHttp=GetXmlHttpObject()
if (xmlHttp.overrideMimeType) {
xmlHttp.overrideMimeType('text/xml; charset=utf-8');
}
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="page.php"
url=url+"?section="+module
url=url+"&opt="+section
url=url+"&howto="+method
var parameters = "email=" + escape(document.getElementById("email").value) +
"&loginFLD=" + escape(document.getElementById("loginFLD").value) +
"&password=" + escape(document.getElementById("password").value) +
"&confpass=" + escape(document.getElementById("confpass").value) +
"&nick=" + escape(document.getElementById("nick").value);
xmlHttp.onreadystatechange=goToPost
xmlHttp.open("POST",url,true)
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", parameters.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(parameters)
}
function goToPost()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("divresult").innerHTML=xmlHttp.responseText
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
i call this script on the <form tag wht the "action stuff
the problem is only in Mozilla Firefox looks like it doesn't take the values or something.
hope you can help me
thank you!