PC端 微信支付 扫码之后页面跳转处理

前端之家收集整理的这篇文章主要介绍了PC端 微信支付 扫码之后页面跳转处理前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。


其实就是用Ajax异步刷新去后台轮询、


  1. if(payType == 'wxPay'){
  2. $.ajax({
  3. url: "********",type: "post",data: {
  4. oId: oId
  5. },success: function(result) {
  6. if(result == 'orderError'){
  7. alert("订单信息异常...");
  8. return false;
  9. }else{
  10. var url = result;
  11. jQuery('#qrcode').qrcode(url);
  12. $(".orderBoxPay").hide();
  13. $(".wxpay-Box").slideDown("fast");
  14. $(".markall").css({
  15. display:"block",height:document.body.clientHeight+"px",});
  16. var repeat = 200; // 限制执行次数为200次
  17. var timer = setInterval(function() {
  18. if (repeat == 0) {
  19. clearInterval(timer);
  20. //处理页面提示信息
  21. } else {
  22. //Ajax后台轮询 查询订单状态
  23. $.ajax({
  24. url: "${path}/pages/order/checkOrderStatus",data: {
  25. oId: oId
  26. },success: function(result) {
  27. if(result == '1'){
  28. clearInterval(timer);
  29. window.location.href = "********";
  30. }
  31. }
  32. });
  33. repeat--;
  34. }
  35. },3000);//3秒执行一次 总共200次 10分钟
  36. }
  37. }
  38. });
  39. }

猜你在找的Ajax相关文章