Cannot connect to my php file

Cannot connect to my php file

BY 28 Oct 2015 Web Application Development

Hi,

I am developping a web application which allow me to connect to my php file (script) into the wamp server. The script test if the login and password are matching (for an authentication purpose)… My application works well when I tested it with the Simulator… but with the emulator it return this message:

 

then it shows me a second blank alert.

here is my code:

<script type="text/javascript">
    function login(){
		
		var lp = document.getElementById("loginp").value;
		var pp = document.getElementById("pwdp").value;
		
			if (lp == "" && pp=="") {
				
				return;
			}
			if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
				xmlhttp = new XMLHttpRequest();
			}

			xmlhttp.onreadystatechange = function(){
				alert("readyState=" + xmlhttp.readyState + "\nstatus="+ xmlhttp.status);
				if (xmlhttp.readyState == 4) {
					alert (xmlhttp.responseText);
				}
			}
			xmlhttp.open("GET","http://127.0.0.1/jme/login.php?name="+lp+"&password="+pp, true);
			xmlhttp.send(true);
		

	}
</script>
</head>

<body>
		<label>Login: </label><input type="text" id="loginp"><br>
		<label>Password: </label><input type="text" id="pwdp"><br>
		<input type="button" onclick="login()" value="Enter" />
	
</body>

 

Besides, I edit the “config.xml” file:

 <access origin="http://127.0.0.1" subdomains="true"/>

 

What am I missing? Thanks in advance.

Written by