优化提交ajax

master
chenzhi 5 years ago
parent b4f08c2430
commit 4c191691d3

@ -44,7 +44,8 @@ class ChangyanController extends Controller {
}
public function test()
{
// $this->assign('pay_amount',"0.01");
$this->assign('user_id',"1");
$this->assign('game_id',"1");
// $this->display("Spend/pay_way");
$this->display("WapPay/wap_shortcut_pay");
# code...

@ -181,7 +181,7 @@
<body>
<!--加载提示框-->
<div class="js_dialog" id="Dialog" style="display: none">
<div class="js_dialog" id="Dialog" style="display: none;">
<div class="weui-mask"></div>
<div class="weui-dialog" style="width: 4.5rem;max-width: 4.5rem;display: flex;flex-direction:column;padding:.4rem .2rem;">
<!-- <div id="close_doalog" style="width: 100%;text-align: left;height: .6rem;display: flex;">
@ -536,7 +536,26 @@
if(isok){
btnpay = true;
Tip.loadShow();
$("#wfform").submit();
//更换表单提交方式
$.ajax({
type: "POST",
dataType: "json",
url: "{:U('WapPay/shortcut_pay')}" ,
data: $('#wfform').serialize(),
success: function (result) {
//处理结果
if(result.status == 0){
Tip.msgShow(result.info);
}
//TODO: 支付成功跳转
console.log(result)
},
error: function() {
Tip.msgShow('网络请求异常,请稍后再试');
}
});
// $("#wfform").submit();
}
})

Loading…
Cancel
Save