Error in javascript

Hello ll,

below is my code to change pin of a user.
When data is entered and submit button is clicked, please wait is coming as programmed in the script after verification. But then nothing is coming, page showing only please wait…
I don’t understand why this is happening.
I am just testing the script that’s why i haven’t used any safety parameters against sql injection

if($pino == "" || $pin1 == ""||$pin2==""){
		echo "login_failed";
else{ $sql= "SELECT pin FROM power WHERE username='shail'";
        $row = mysqli_fetch_row($query);
		$pin = $row[0];
	  	if($pino != $pin)
		{	echo "login_failed"; exit();	}

<!doctype html>
<meta charset="utf-8">
<title>Untitled Document</title>
<script src="main.js"></script>


      <form id="pinchng" onsubmit="return false;">
      <input type="password" id="pino" placeholder="Old Pin" onfocus="emptyElement('status')">
      <input type="password" id="pin1" placeholder="New Pin" onfocus="emptyElement('status')">
      <input type="password" id="pin2" placeholder="Confirm Pin" onfocus="emptyElement('status')">
      <button id="pinchngbtn" onclick="change()">Submit</button> 
      <p id="status"></p>
function emptyElement(x){
	_(x).innerHTML = "";
function change()
		var pino = _("pino").value;
		var pin1 = _("pin1").value;
		var pin2 = _("pin2").value;
		if(pino == "" || pin1 == ""||pin2==""){
		_("status").innerHTML = "Fill out all of the form data";
      else if(pin1!=pin2)
	  { _("status").innerHTML = " New Passwords mis-matched";}
	 else {
		_("pinchngbtn").style.display = "none";
		_("status").innerHTML = 'please wait ...';
		var ajax = ajaxObj("POST", "change.php");
        ajax.onreadystatechange = function() {
	        if(ajaxReturn(ajax) == true) {
	            if(ajax.responseText == "login_failed"){
					_("status").innerHTML = "Login unsuccessful, please try again.";
					_("pinchngbtn").style.display = "block";
				} else {
                   _("status").innerHTML = "Login unsuccessful, please try again.";				}


Check error console to see if a JavaScript error is being produced. If not, then the JavaScript is working, but the process isn’t completing.

Looking at your code, I see two echos for process failed, but nothing for success. Is the script returning anything for successful process? Any indication it was completed?

Hey bro…
i completed the the script now its working as required. Thanks for the idea.


Glad you got it working. Just out of curiosity, what was the issue and how did you resolve it?

Actually, i forgot to source the ajax script for it. everything else was ok