javascript - how to send post data in jquery using ajax -
i have simple form , want input field losses focus event fired check content if , replies accordingly that
$("document").ready(function() $("#txt_email").blur(function() { var email=$("#txt_email").val(); $.post('ajax/tester.php', {chk:email}, function(data) { alert(data) ; }); }); });
so have done till it's showing nothing: no error, no output. using jquery 1.9.1
, want know how check value of post data on ajax/tester.php
page
right doing
$tochk=isset($_post['chk'])?$_post['chk']:null; echo $tochk;
i hope helps:
$(function(){ $("#txt_email").blur(function() { var email=$("#txt_email").val(); alert('email: ' + email); var jqxhr = $.post('ajax/tester.php', {chk:email}); jqxhr.done(function(data) { alert(data); }); jqxhr.fail(function() { alert("error"); }); }); }); window.onerror = function(errormessage, url, line) { var errortext = 'message: ' + errormessage + '\nurl: ' + url + '\nline: ' + line; alert(errortext); }
Comments
Post a Comment