获得从$。员额响应 [英] getting a response from $.post

查看:122
本文介绍了获得从$。员额响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 $。交调用一个AJAX页面。

  $岗位(ajaxpage.php,$(#theform)序列化());
 

我怎么能呼应返回的页面的响应?我试着保存到一个变种,但它不给我答复。

  VAR RESP = $。员额(ajaxpage.php,$(#theform)序列化());
执行console.log(RESP);
 

解决方案

  $。员额(ajaxpage.php,$(#theform)。序列化()函数(数据,状态,XHR){
    的console.log(数据);
});
 

I'm calling an ajax page using $.post.

$.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 resp = $.post("ajaxpage.php", $("#theform").serialize());
console.log(resp);

解决方案

$.post("ajaxpage.php", $("#theform").serialize(), function(data, status, xhr) {
    console.log(data);
});

这篇关于获得从$。员额响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆