$(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 this jquery script wherein it creates a post request “invisibly” after submitting the form. thus not refreshing the page. the problem is how can i get the response of the foo.php or rather what will i put in foo.php to give back a response?
for example i inputted ‘hello’, how can i display ‘hi’ on #display? something like that xD
You would have
foo.phpecho whatever content you want to go inside the element that corresponds to#display— no more, no less. So this would work: