How to catch php message return value and show it by java script alert?
i'm using HTML5 form validation and and wana to change custom validation
error to user, but i found a function that works on javascript, my problem
is that my consol give me some tip, it said TypeError:
$(...).setCustomValidity is not a function, i know that it,s java scripts
function, so what should i use in jquery??? is there any same function??
$(document).ready(function() {
//the min chars for username
//when field is focus out
$('#phone').focusout(function(){
//run the character number check
//get the phone
$phone = $('#phone').val();
//use ajax to run the check
$.ajax({
url: 'check.php',
type: 'POST',
dataType: 'html',
data: {
phone : $('#phone').val()
},
success:function(response){
if(response == "1"){
$('#phone').setCustomValidity('blahblahbla ');
}
}
});
});
here is my code, thanks for your answers.
No comments:
Post a Comment