I got a lil problem. I made Register and i can send all my info properly but the PHP response gives back a file to download with the response. I have made login and changepage with ajax and i have no problem, Someone help?
Greetz Aropop
Printable View
I got a lil problem. I made Register and i can send all my info properly but the PHP response gives back a file to download with the response. I have made login and changepage with ajax and i have no problem, Someone help?
Greetz Aropop
Could you please expand, and paste the code you're using.
first did you pm your self the web problem?
yea please provide at least some code so that we can see where the error might be.
and not everyone is perfect...Code:var xmlhttp;
function login()
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
{
alert ("Browser does not support HTTP Request");
return;
}
var username=document.getElementById("username").value;
var password=document.getElementById("password").value;
var data="?username="+username+"&password="+password;
var url="./forms/login.php";
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("POST",url,true);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlhttp.send(data);
}
function register()
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
{
alert ("Browser does not support HTTP Request");
return;
}
var rusername=document.getElementById("rusername").value;
var rpassword=document.getElementById("rpassword").value;
var rpassword2=document.getElementById("rpassword2").value;
var remail=document.getElementById("remail").value;
var rsex=document.getElementById("rsex").value;
var rdata="?username="+rusername+"&password="+rpassword+"&password2="+rpassword2+"&email="+remail+"&sex="+rsex;
var rurl="./register.php";
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("POST",rurl,true);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlhttp.send(rdata);
}
function stateChanged()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("main").innerHTML=xmlhttp.responseText;
}
if(xmlhttp.readyState!=4){
document.getElementById("main").innerHTML="Loading";
}
}
function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
{
return new XMLHttpRequest();
}
if (window.ActiveXObject)
{
return new ActiveXObject("Microsoft.XMLHTTP");
}
return null;
}
i was just pointing something out.
Hmm, can you paste an extract of your register script?
I'll be happy to assist you privately too. Also, just a small advice, I would encourage you to use jQuery instead. Although it's basically the same, it'll save you more time in terms of actually coding the function and it would be easier to debug in my opinion.