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

c++ - How to modify context menu of internet explorer using IDocHostUIHandler::ShowContextMenu? -

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

c# - Getting "Internal .Net Framework Data Provider error 30" error when column has NULL value -