[英]AJAX request (HTTPS) not responding on iPhone
$(function () {
var apiEndpoint = "https://www.myaddress.com/api/";
var getVersion = $.ajax({
url: apiEndpoint + "version/",
dataType: "JSON",
username: "myuser",
type: "GET",
password: "mypass"
});
getVersion.done(function (version) {
alert("HEY!!!!!!!!!!");
});
getVersion.fail(function () {
alert("I'm not invoked either!");
});
});
此代碼在我的台式機上的Chrome上可以正常運行,但是在iPhone上調用該頁面時,不會顯示任何警報。 任何想法為什么會這樣?
我感覺是因為https://
,但是為什么這只是iPhone上的問題,我該如何解決?
嘗試使用以下代碼:
$(function () {
var apiEndpoint = "https://www.myaddress.com/api/";
var getVersion = $.ajax({
url: apiEndpoint + "version/",
dataType: "JSONP",
username: "myuser",
type: "GET",
password: "mypass",
async:false,
cache:false,
});
getVersion.done(function (version) {
alert("HEY!!!!!!!!!!");
});
getVersion.fail(function () {
alert("I'm not invoked either!");
});
});
async
和cache
設置為false
只是為了確保不從緩存中獲取數據。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.