when pressing submit button, didnt show anythg in span status. it shud b change 'zzz' to 'check availability', after that either show 'availability' or other msg from my php file, but it juz show till 'check availability' and bck to 'zzzz', so is there any error?? pls help me!!!!
Code:
$(document).ready(function(){
$("#submit").click(function()
{
var noIC = $("#noIC").val();
var password = $("#password").val();
var msgbox = $("#status");
msgbox.html('Checking availability');
$.ajax({
type: "POST",
url: "loginphp.php",
data: "noIC=" + noIC,
success: function(msg){
alert(msg);
$("#status").ajaxComplete(function(event, request){
if(msg == "OK"){
alert('Handler for .click() called.');
msgbox.html('availability')
}
//$(document.location = "order1.html");
else{
alert('Handler for .click() called.');
msgbox.html(msg);}
});
}
});
});
});
</script>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<p>
<label>IC
<input type="text" name="noIC" id="noIC" />
</label>
</p>
<p>
<label>password
<input type="text" name="password" id="password" />
<span id="status">zzzz</span>
</label>
</p>
<p>
<label>
<input type="submit" name="submit" id="submit" value="Submit" />
</label>
</p>
</form>