- <script type="text/javascript">
- $(document).ready(function () {
- setInterval("ajaxstatus()", 5000);
- });
- //$("#HidOrderid").val() 为订单号码
- function ajaxstatus() {
- if ($("#HidOrderid").val() != 0) {
- var HidOrderid = $("#HidOrderid").val().trim();
- //alert(HidOrderid);
- $.ajax({
- url: "<?php echo site_url('wxpay/GetOrderStatus')?>",//调用ashx获得订单状态
- data:{
- HidOrderid:HidOrderid
- },
- dataType:"html",
- type:"POST",
- success: function (json) {
- json = eval('('+json+')');
- // alert(json.HidOrderid);
- if (json.Satues ==1) { //订单状态为1表示支付成功
- window.location.href = "<?php echo site_url('wxpay/payok')?>"; //页面跳转
- }
- if (json.Satues ==2) { //订单状态为1表示支付成功2支付失败
- alert("订单已经超时,请重新提交订单,支付,谢谢。");
- }
- },
- error: function () {
- alert("微信支付失败,请重新提交订单,支付,谢谢。");
- }
- });
- }
- }
- </script>
复制代码 |