$.ajax调用don';无法在android设备上运行

$.ajax调用don';无法在android设备上运行,android,jquery,ajax,cordova,visual-studio-cordova,Android,Jquery,Ajax,Cordova,Visual Studio Cordova,Javascript代码: var googledocsurl = "https://docs.google.com/viewer?url="; $.ajax({ url: window.localStorage.getItem('basePath') + 'pdf/GetPdfUrls', type: "GET",

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'); },
                })
如果我单击“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"}]
如果你需要更多的信息,请询问,我会尽力提供!
提前感谢所有的帮助

好吧,我现在不觉得自己很愚蠢了

像手机这样的接缝在未连接到wifi网络时没有任何互联网,它会随机断开与路由器的连接,然后连接到另一个具有相同信号强度的wifi网络(没有互联网连接),然后随机更改回原来的网络(猜测它会使用具有最佳信号强度的已知网络)

我很幸运,我看了logcat日志,看到了这种变化,否则我会被卡住一段时间:/


无论如何,谢谢大家的帮助

尝试清理并重新生成解决方案。用try-catch块包围它,看看你是否得到任何响应。它是否有可能在basePath或userid保存到本地存储之前尝试此ajax调用?@ClaytonLeis如果是这样,那么响应将是空的,不包含数据,对吗?手机是否有问题?因为现在它又能工作了…对,如果是这样的话,你就不会得到任何JSON数据了。
[{"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"}]