当前位置:Gxlcms > PHP教程 > jquery的$post方法请问

jquery的$post方法请问

时间:2021-07-01 10:21:17 帮助过:15人阅读

jquery的$post方法 请教
想让前台把文本框中的手机号提交到后台,然后调后台方法给手机发送短信

function sendMessage() {
 curCount = count;
  //设置button效果,开始计时
$("#btnSendCode").attr("disabled", "true");
$("#btnSendCode").val("请在" + curCount + "秒内输入验证码");
InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器,1秒执行一次
   //向后台发送处理数据
alert("aaaaaaaaa");
$.ajax({
  type: "POST", //用POST方式传输
  dataType: "text", //数据格式:JSON
  url: 'http://www.xxxxx.com:81/member/send_code', //目标地址
   data: "dealType=" + dealType +"&uid=" + uid + "&code=" + code,//这行 我试着去了
   error: function (XMLHttpRequest, textStatus, errorThrown) { },
  success: function (msg){ }
});
}
这样写有问题吗?

后台方法没有执行,没有跳转, 我是想让前台把文本框中的手机号提交到后台,然后调后台方法给手机发送短信
public function send_code(){

echo '';


}


哪位前辈有示例啊? 这个$post不会用。 谢谢

------解决思路----------------------
确认 http://www.xxxxx.com:81/member/send_code 不是跨域
------解决思路----------------------
error: function (XMLHttpRequest, textStatus, errorThrown) {alert(textStatus);},
success: function (msg){alert('OK');}
弹出什么?

人气教程排行