【发布时间】:2012-03-30 12:23:35
【问题描述】:
我在 ASPX 页面中有以下代码,当单击 PayPal 图标时,该代码与 Page Method 连接并检索会话的 PayPal 令牌。这在IE中执行时完美运行,但在Chrome或Firefox中执行时,jQuery的$.ajax调用立即返回代码0的错误。
$(document).ready(function () {
$("input.PayPal").click(function () {
$.ajax({
type: "POST",
url: "MyCurrentPage.aspx/PayPal",
data: "{IdRecibo : " + $(this).attr("data-value") + "}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
if (result.d.Result == "Success") {
window.location.href = result.d.Redirect;
}
else
alert("El servicio de PayPal está temporalmente deshabilitado.");
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
});
});
【问题讨论】:
-
不知道是不是跟不寻常的url格式
ListadoExpedienteEconomico.aspx/PayPal有关。我注意到 Chrome/FF somtimes 解析文件夹路径的方式与 IE 不同。 -
我试过用 Fiddler 检查请求和返回值(毕竟 Page Method 调用是 Service 调用),返回值符合预期。
-
throwedError 有错误说明吗?
-
无错误说明。只有代码 0。
-
用chrome检查控制台,应该是报错。您可以做的另一件事是在要调试的脚本上放置一个断点,或者添加一个“调试器”; “成功”和“错误”一样
标签: jquery asp.net internet-explorer google-chrome pagemethods