jQuery give response after an ajax request -
$(document).ready(function(){ $("form#fbox").submit(function(){ var msg = $("input#ibox").val(); $.get("foo.php", {m: msg}, function(data){ $('#display').html(data); }); return false; }); });
i have jquery script wherein creates post request "invisibly" after submitting form. not refreshing page. problem how can response of foo.php or rather put in foo.php give response?
for example inputted 'hello', how can display 'hi' on #display? xd
you have foo.php
echo whatever content want go inside element corresponds #display
-- no more, no less. work:
echo 'hi';
Comments
Post a Comment