Jump to content

Problem http.onreadystatechange = fuction doesnt work


immunity
 Share

Recommended Posts

i have put 3 times alert("Compiler is here!"); but only once is pop up (and whole other script doenst work in site :/)Site is loaded after hiting OK on the Compiler is here (first and only :/)

<head><script src="clock.js"></script><script type="text/javascript">account=getCookie('username');alert(account);if (account!=""){	alert(account);	mid= account.indexOf(";");	name= account.substring(0,mid);	pass= account.substring(mid+1,account.length -1);	url = "checklogin.php?p="+pass+"&a="+name;	alert("Compiler is here!");	http.open("GET",url,true);	http.onreadystatechange = function() 	{	alert("Compiler is here !");		if(http.readyState == 4 && http.status == 200) 			{				alert("Compiler is here!");				var results= http.responseText;				if (results ==0)				{					document.getElementById("membermenu").innerHTML="Kalos ir8ate<br>"+usr+"<br><strong><div id ='logout' onClick=logout(); >Logout</strong>";				}				else if (results==1)				{					window.location="admin.html";				}				else if (results.match("error"))				{					alert("Εισάγατε λάθος κωδικό/λογαριασμό");				}							}	}	http.send(null);	}

Link to comment
Share on other sites

You should check Javascript errors, it will give you errors indicating things like http is null or not an object. Also, Javascript doesn't have a compiler, it has an interpreter. If you do this you should see that the line between the alerts is causing a fatal error because the third line does not get executed:alert("point 1");http.open("GET",url,true);alert("point 2");You can check the Javascript console in your browser to see the actual error message.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...