I've a html user profile form where data is comming from mysql database. I'm currently calling ajax when user hover out the mouse from input field using jquery .blur(). Now I want to know how can I call this ajax when user actually type something on input field ?
Jquery/Ajax Code:
<script>
$("#given_name").blur(function(){
var given_name = $("#given_name").val();
$.ajax({
url: 'certainfield.php',
type: 'POST',
dataType: 'html',
"given_name" : given_name
}).done(function ( data ) {
$('#r').append(data);
});
});
</script>
Html Code:
<tr>
<td>Given name</td>
<td><input type="text" value="<?php echo $res['given_name'] ?>" name="given_name"
id="given_name" placeholder="Given name"/></td>
</tr>