function regist(nome,pwd){
URL+="register?nick=" + nome + "&key=" + pwd;
var req = new XMLHttpRequest();
req.open("get", URL, true);//Assincrono
req.onreadystatechange = function(){
if (req.readyState != 4) {
return;
}
else if (req.status != 200) {// Tratamento de erro (e.g., mostrar mensagem de erro)
return;
}
var data=JSON.parse(req.responseText);
alert(data);
if(data.error==null || data.error==undefined){
document.getElementById("register").innerHTML="Registo Bem Sucedido";
}
else{
document.getElementById("register").innerHTML="Utilizador já registado - Password errada";
}
};
req.send();
};
I CANT ACCESS at var data.. Maybe because "*req.onreadystatechange = function(){-----" What's appening? My alert to data isn't working, it was not readed.. Can you help me?>the URL is correctly defined, don't worry ;)
I don't know nothing about same origin policy problem... The URL used in GET is: dcc.fc.up.pt:8080/TabuWeb/rest/register?nick=ola&key=mundo My page URL: file:///home/carlos/public_html/TabuWeb2/WebContent/index.html?nick=ola&key=mundo
Is there any problem about same origin policy??That's Why my req.status=0 and firebug is pointig to req.send()?
Thanks