Reputation: 23
For iPhone browser ajax request using javascript is not working,i used the following code for ajax request
$.ajax({
type: type,
url:requestURL,
dataType: "text",
success: successCallback,
error: function (request, ajaxOptions, exception){
alert(request.status);
alert(exception);
}
});
Upvotes: 0
Views: 910
Reputation: 7100
localhost
is not on your iPhone (or iPhone simulator)
If your machine and iphone are within the same (wireless) network, replace localhost with your machine's IP address and it will work fine.
Or better way, upload your files to some free domain and the test it using the hostname/domain name/ip address of the server
Upvotes: 2
Reputation: 2377
I think the problem with the datatype:"text". remove the datatype option from your ajax request.Do it like this.
$.ajax({
type: type,
url:requestURL,
success: successCallback,
error: function (request, ajaxOptions, exception){
alert(request.status);
alert(exception);
}
});
Upvotes: 0