$.ajax 通话在 android 台设备上无法接通
$.ajax calls don't go through on android devices
Javascript代码:
var googledocsurl = "https://docs.google.com/viewer?url=";
$.ajax({
url: window.localStorage.getItem('basePath') + 'pdf/GetPdfUrls',
type: "GET",
data: { id: window.localStorage.getItem('userid') },
dataType: "json",
beforeSend: function () { $.mobile.loading('show'); },
success: function (returnValue) {
for (var i = 0; i < returnValue.length; i++) {
$('#pdfList').append("<li><a onclick=\"window.open('" + googledocsurl + window.localStorage.getItem('basePath') + returnValue[i].pdfUri + "\', '_blank', 'location=yes')\">" + returnValue[i].PdfCreationDate + "</a></li>")
}
},
error: function () {
},
complete: function () { $.mobile.loading('hide'); },
})
如果我在模拟器上尝试这个 ajax 调用并且 ripply 它工作没有问题但是当我在我的 android 设备上尝试它时它工作了 1/50 次,它很好不一致,这使得修复或理解变得非常困难
我在 Visual Studio
中看到的错误
Failed to load resource: net::ERR_NAME_NOT_RESOLVED
GetPdfUrls(0,0)
如果我单击 "GetPdfUrls(0,0)" 我可以看到响应并且它填充了数据但是出于某种原因这给了我错误但据我所知这对我来说没问题(特别是感觉它有效我尝试了 50 次中的 1 次)
回复:
[{"pdfUri":"Image/GetPdf/8259ff54-6cd2-48dd-a0dc-d39b255e9bad","PdfCreationDate":"2014-12-08"},{"pdfUri":"Image/GetPdf/f05ff375-45e2-429b-a8fc-2c9d660df263","PdfCreationDate":"2014-12-08"},{"pdfUri":"Image/GetPdf/211feab8-9715-4942-bf8c-f7e95188c987","PdfCreationDate":"2014-12-08"},{"pdfUri":"Image/GetPdf/6ded622b-2d3e-4151-8be3-01070d1b9d69","PdfCreationDate":"2014-12-08"},{"pdfUri":"Image/GetPdf/f34adfa9-7bbf-4db9-b7ee-92fd619b0dc0","PdfCreationDate":"2014-12-08"},{"pdfUri":"Image/GetPdf/b6e5e56c-68d3-4662-a00e-b11dc09bfd9a","PdfCreationDate":"2014-12-08"},{"pdfUri":"Image/GetPdf/cc633e61-adcd-414d-bfc7-d09a30e05b01","PdfCreationDate":"2014-12-15"}]
如果您需要更多信息,请尽管询问,我会尽力提供!
预先感谢所有帮助
嗯,我现在不觉得自己很傻吗...
像 phone 这样的接缝在未连接到 wifi 网络时没有任何互联网,并且接缝随机失去与路由器的连接并连接到另一个 wifi 网络(没有互联网连接) ) 具有相同的信号强度,然后随机变回(猜测它采用具有最佳信号强度的已知网络)。
我很幸运,我看到了 logcat 日志并看到了这种变化,否则我会被卡住一段时间:/
无论如何感谢大家的帮助!
Javascript代码:
var googledocsurl = "https://docs.google.com/viewer?url=";
$.ajax({
url: window.localStorage.getItem('basePath') + 'pdf/GetPdfUrls',
type: "GET",
data: { id: window.localStorage.getItem('userid') },
dataType: "json",
beforeSend: function () { $.mobile.loading('show'); },
success: function (returnValue) {
for (var i = 0; i < returnValue.length; i++) {
$('#pdfList').append("<li><a onclick=\"window.open('" + googledocsurl + window.localStorage.getItem('basePath') + returnValue[i].pdfUri + "\', '_blank', 'location=yes')\">" + returnValue[i].PdfCreationDate + "</a></li>")
}
},
error: function () {
},
complete: function () { $.mobile.loading('hide'); },
})
如果我在模拟器上尝试这个 ajax 调用并且 ripply 它工作没有问题但是当我在我的 android 设备上尝试它时它工作了 1/50 次,它很好不一致,这使得修复或理解变得非常困难
我在 Visual Studio
中看到的错误Failed to load resource: net::ERR_NAME_NOT_RESOLVED
GetPdfUrls(0,0)
如果我单击 "GetPdfUrls(0,0)" 我可以看到响应并且它填充了数据但是出于某种原因这给了我错误但据我所知这对我来说没问题(特别是感觉它有效我尝试了 50 次中的 1 次)
回复:
[{"pdfUri":"Image/GetPdf/8259ff54-6cd2-48dd-a0dc-d39b255e9bad","PdfCreationDate":"2014-12-08"},{"pdfUri":"Image/GetPdf/f05ff375-45e2-429b-a8fc-2c9d660df263","PdfCreationDate":"2014-12-08"},{"pdfUri":"Image/GetPdf/211feab8-9715-4942-bf8c-f7e95188c987","PdfCreationDate":"2014-12-08"},{"pdfUri":"Image/GetPdf/6ded622b-2d3e-4151-8be3-01070d1b9d69","PdfCreationDate":"2014-12-08"},{"pdfUri":"Image/GetPdf/f34adfa9-7bbf-4db9-b7ee-92fd619b0dc0","PdfCreationDate":"2014-12-08"},{"pdfUri":"Image/GetPdf/b6e5e56c-68d3-4662-a00e-b11dc09bfd9a","PdfCreationDate":"2014-12-08"},{"pdfUri":"Image/GetPdf/cc633e61-adcd-414d-bfc7-d09a30e05b01","PdfCreationDate":"2014-12-15"}]
如果您需要更多信息,请尽管询问,我会尽力提供! 预先感谢所有帮助
嗯,我现在不觉得自己很傻吗...
像 phone 这样的接缝在未连接到 wifi 网络时没有任何互联网,并且接缝随机失去与路由器的连接并连接到另一个 wifi 网络(没有互联网连接) ) 具有相同的信号强度,然后随机变回(猜测它采用具有最佳信号强度的已知网络)。
我很幸运,我看到了 logcat 日志并看到了这种变化,否则我会被卡住一段时间:/
无论如何感谢大家的帮助!