jquery - ajax post with PHP -
jquery - ajax post with PHP -
why isn't working?
jquery ajax code:
$("header input").bind("keyup", function() { var searchstring= $("header input").val(); var datastring = 'search=' + searchstring; alert(datastring); $.ajax({ type: "post", url: "index.php", data: datastring, cache: false }); });
php code(just test code):
if($_post["search"]) { echo "test message!"; }
it doesn't show echo :/
thanks ur help ;)
you need display info receive ajax call. example, set result <div>
called yourresultdiv
:
try this
$("header input").on("keyup", function () { var searchstring = $("header input").val(); var datastring = 'search=' + searchstring; alert(datastring); $.ajax({ type: "post", url: "index.php", data: datastring, cache: false, success: function (data) { $('#yourresultdiv').html(data); alert("successful"); } }); });
php jquery ajax
Comments
Post a Comment