0 Replies - 5912 Views - Last Post: 18 August 2011 - 06:11 AM

#1 SubbuDreamsCode  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 18-August 11

Ajax HTTPS POST call works in Android but does not in iPad

Posted 18 August 2011 - 06:11 AM

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!

Is This A Good Question/Topic? 0
  • +

Page 1 of 1