//主要是添加同步处理
$.ajax({
url: "ashx/OrderHander.ashx?action=CheckRepeat",
data: { "OrderId": data.OrderNo },
dataType: "json",
async:false,
type: "post",
success: function (data) {
if (data == "") {
window.location.href = "index.html";
return;
} else {
//var v = $("input[name='approve']:checked").val()
var i = 0.01; //支付价格处理,暂时设置为0.01
//location.href = "/create_direct_pay_by_user-CSHARP-UTF-8/pay.aspx?paytypeid=1&username=" + i + "&Orderid=" + data.OrderNo + "";
result = "/create_direct_pay_by_user-CSHARP-UTF-8/pay.aspx?paytypeid=1&username=" + i + "&Orderid=" + data.OrderNo + "";
}
if (result.length > ) {
window.open(result, "_blank");
return;
}
}
});
ajax请求跨域问题
一般处理程序开发的接口,需要使用
context.Response.AddHeader("Access-Control-Allow-Origin", "*");
来处理返回值。可躲避跨域问题。不过只兼容最新浏览器。故不建议使用一般处理程序来做跨域接口,可采用WEBAPI等。