<script type="text/javascript">
function chkform(form)
{
var ar = document.getElementById("a1").value;
if(ar=="true")
{
}
else {
return false;
}
function userchaked(str)
{
if(window.XMLHttpRequest)
{
xmlhttp= new XMLHttpRequest();
}
xmlhttp.onreadystatechange = function()
{
if(xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("msg").innerHTML = xmlhttp.responseText;
if(xmlhttp.responseText=='USER NAME NOT VALID')
{
document.getElementById("a1").value= "false";
}
else {
document.getElementById("a1").value= "true";
}
}
}
xmlhttp.open("GET","ajax.php?id="+str,true);
xmlhttp.send();
}
</script>
<form name="f2" method="post" enctype="multipart/form-data" style=" margin-top: -100px;" onsubmit="return chkform(this);">
<input type="text" name="txtuname" placeholder="Enter User Name" onblur="userchaked(this.value)"/>
//this hidden field
<input type="hidden" name="a1" value="" id="a1" />
</form>
function chkform(form)
{
var ar = document.getElementById("a1").value;
if(ar=="true")
{
}
else {
return false;
}
function userchaked(str)
{
if(window.XMLHttpRequest)
{
xmlhttp= new XMLHttpRequest();
}
xmlhttp.onreadystatechange = function()
{
if(xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("msg").innerHTML = xmlhttp.responseText;
if(xmlhttp.responseText=='USER NAME NOT VALID')
{
document.getElementById("a1").value= "false";
}
else {
document.getElementById("a1").value= "true";
}
}
}
xmlhttp.open("GET","ajax.php?id="+str,true);
xmlhttp.send();
}
</script>
<form name="f2" method="post" enctype="multipart/form-data" style=" margin-top: -100px;" onsubmit="return chkform(this);">
<input type="text" name="txtuname" placeholder="Enter User Name" onblur="userchaked(this.value)"/>
//this hidden field
<input type="hidden" name="a1" value="" id="a1" />
</form>
No comments:
Post a Comment