我正在使用$.post调用ajax页面:
$.post("ajaxpage.php", $("#theform").serialize());
如何回显页面返回的响应?我尝试将其保存到var中,但是并没有给我任何答复信息。
var resp = $.post("ajaxpage.php", $("#theform").serialize());
console.log(resp);
http://api.jquery.com/jQuery.post/
$.post("ajaxpage.php", $("#theform").serialize(),function(data){
$('#yourDivId').html(data);//data is what you recived from the server
});
$.post("ajaxpage.php", $("#theform").serialize(), function(data, status, xhr) {
console.log(data);
});