javascript - Why is ajax 'GET' request hanging on an iOS phonegap app? -


my phonegap app includes javascript workflow populate web database (sqlite). workflow consists of sequence of ajax 'get' requests executed synchronously (the individual ajax requests async, 1 request won't start until previous 1 finished).

i observing intermittently request hang (neither succeed nor fail) indefinitely. when set timeout on ajax request, request timeout. when does, xmlhttprequest has following state:

status: 0 readystate: 0 statustext: 'timeout' 

what blows mind if set proxy , watch net traffic through fiddler, see request made, and expected response returned server within 60 second timeout.

update: if monitor net traffic of dev ipad via developer tools on safari, observe request not seem response. seems response either not making it, or being ignored device.

i have not been able reproduce error on nexus 7 running android, or running in chrome on workstation, leads me believe issue specific ios (version 6.1.3)

here simplified example of applicable code:

function syncwebdatabase() {     var sqlscript;      return retrieveentity('users', sqlscript )         .then(function () {             return retrieveentity('accounts', sqlscript );         })         .then(function () {             return retrieveentity('orders', sqlscript );         })         .then(function () {             return retrieveentity('shipments', sqlscript );         })         .then(function () {             return executescript(sqlscript);         }); }  function retrieveentity(entityname, sqlscript) {     return $.ajax({              url: 'http://myrestfulservice/' + entityname,              type: 'get',              datatype: 'json',              timeout: 60000,              error: function(jqxhr, textstatus, errorthrown) {                //handle error condition              }            }).then(function (entites) {                return generateinsertstatements(entities, sqlscript);            })  }  function generateinsertstatements(entities, sqlscript) {     //appends insert statement each entity sqlscript }  function executescript(sqlscript) {     //executes sql script against web database } 

i appreciate explanation observing, solution problem or comments how further investigate issue.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -