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

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -