[英]getting a response from $.post
I'm calling an ajax page using $.post
. 我正在使用
$.post
调用ajax页面。
$.post("ajaxpage.php", $("#theform").serialize());
How can I echo the response that the page returned? 如何回显页面返回的响应? I tried saving to a var, but it's not giving me the response.
我尝试将其保存到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/ http://api.jquery.com/jQuery.post/
$.post("ajaxpage.php", $("#theform").serialize(),function(data){
$('#yourDivId').html(data);//data is what you recived from the server
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.