This is my first question, so sorry if I break some rule. I know this may seem duplicate, but every answer I found here and on the Internet did not give me any result.
I am developing a multi-platform, multi-page SOAP-XML web service application for iOS, Android and Windows Phone. Everything is fine with iOS and Android, but when porting to Windows Phone 7/8 I ran into this unpleasant problem: any jQuery.ajax (internal and external) and derivatives ($ .load, $ .get) calls are triggered, but, by apparently never gets an answer.
I am currently using jQuery 2.0.2, Cordova 2.5.0 and Weinre for debugging. I disabled jQuery mobile due to the complexity of the code that it generated (so not to use for $ .mobile.allowCrossDomainPages).
This is my code for one ajax internal call for navigation
$("#base_page").load( thePage, function () { console.log("------------ loadPage: ", thePage, " loaded"); $(document).trigger("pageload", [thePage]); } );
This does not give me any answer.
And here is the code for one ajax external call for WS data mining
$.ajax({ url: soapURL, type: "POST", dataType: "xml", data: createSOAPRequest(soapWS, soapParams), contentType: "text/xml; charset='utf-8'", beforeSend: function(xhr) { console.log("β’β’β’β’β’β’β’β’β’β’β’β’β’β’ ready to send ajax"); xhr.setRequestHeader('SOAPAction', soapURL); }, error: function(jqXHR, textStatus, errorThrown) { console.log("β’β’β’β’β’β’β’β’β’β’β’β’β’β’ error"); navigator.notification.alert(textStatus + "\n" + errorThrown); }, success: function(theXML) { console.log("β’β’β’β’β’β’β’β’β’β’β’β’β’β’ success"); console.log(theXML);
This writes to the console "β’β’β’β’β’β’β’β’β’β’β’β’β’β’β’ readiness to send ajax", then absolutely nothing more.
I think I tried everything I could find here and in other sources on the Internet. If I donβt miss anything, I tried
- $. support.cors = true from here or here
- any cache combination: false, crossDomain: true, xhrFields: {withCredentials: true}
- deactivation of parts of win.XMLHttpRequest Cordoba code as here
- description of each local url, absolute or relative, simple (page only) or full path (starting with / www or / app / www or even with the full MS protocol)
- URI in whitelisted in config.xml
but to no avail. JSONP is not an option since the server is throwing an error with a callback value.
The problem is that I never get an error / success message (so it is different from this ), as if no data was coming from the WebService. Everything works like a charm on other OSs, so I'm sure the WebService calls are correct.
As a desperate solution, I have already managed to rewrite the internal calls using the XMLHttpRequest object, and this part is now ok. But before rewriting the more complex POST calls to WebService, I wonder if there is a way to restore (easier and already working) jQuery.ajax functionality.