废话不多说,直接上代码
$.ajax({
type : "get",
url : weixinPay,
async: false,
dataType:"json",
success : function(json) {
if (json.result == "ok") {
window.location.href = json.mwebUrl;
} else {
alert(json.desc);
}
},error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log(XMLHttpRequest.status);
console.log(XMLHttpRequest.readyState);
console.log(textStatus);
}
});