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