I am using one seperate php script to validate
<?php
//db connectivity
//Query
//Value Checking
?>
then call this script from javascript using ajax
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script language="javascript">
function getMeStatus(parameter){
var def = $.Deferred(); // Create a deferred object
$.ajax({ // Make the ajax call
type: "POST",
url: "checkvalue.php",
data: {check: parameter}
}).done(function (data) {
if (data !== "success"); {
var val = confirm(data);
if (val === false) {
// Status was false?
def.resolve(false);
}
else {
// Status was true?
def.resolve(true);
}
}
else {
// Status was true?
def.resolve(true);
}
}
// return a promise to supply the boolean status value later
return def.promise();
});
</script>