What's new
Apple iPad Forum 🍎

Welcome to the Apple iPad Forum, your one stop source for all things iPad. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Ajax HTTPS POST call does not work in iPad

SubbuEatsApple

iPF Noob
Joined
Aug 18, 2011
Messages
1
Reaction score
0
Location
India
Hi,

We are developing a mobile app to be ported to the Android and IPAD platforms. The idea is to use the same code and create APK and IPA files as deployable apps for Android and IPAD respectively using Phonegap build process.

The app makes an Async xmlHttpRequest call to a REST based HTTPS URL using POST Method. The response is in JSON format.

The call works well from the app deployed on the Android platform and gets back with proper response and HTTP status code(200). But, the same app call fails from the IPAD. It returns an xmlHttpRequest response status code 0. Looking at this, there does not seem to be an issue of Cross-Domain here since the call from the app from Android works well to the same URL.

Any ideas as to what could be the problem with the call in IPAD?

Here is the code snippet used:

var xmlhttp = new XMLHttpRequest();
xmlhttp.open('POST', url, true);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
var myform = document.forms[0];
var reqBody = getRequestBody(myform);
xmlhttp.send(reqBody);
xmlhttp.onreadystatechange = function() {
// If state == 4, read the status code.
}

Thanks a lot!
 

Most reactions

Latest posts

Top