title: AJAX to Sharepoint Server with Phonegap and JQuery Mobile not working
body: <p>I have the following Problem. In the Phonegap App(for Android) I want to make an AJAX-Call to connect with a Sharepoint Server, with the following Code:</p>
  
  <pre><code> $.ajax({  
     url:"https://xxx/_vti_bin/lists.asmx",
  
     beforeSend: function( xhr ){
      xhr.setRequestHeader(
      "SOAPAction",
      "http://schemas.microsoft.com/sharepoint/soap/GetListCollection"
      );
      xhr.setRequestHeader("Content-Type","text/xml; charset=utf-8");
      }, 
     dataType:"xml",  
     contentType: "application/xml; charset=utf-8", 
     timeout:10000,  
     type:'POST', 
     cache: false,
     username: "username",
     password: "password",
     data: soapEnv,
     success:function(data) {
         // alert data
         var serializer = new XMLSerializer();
          serialized = serializer.serializeToString(data);
         alert(serialized);
     },  
     error:function(XMLHttpRequest,textStatus, errorThrown) {   
         // alert errors
       alert("Error status :"+textStatus);  
       alert("Error type :"+errorThrown);  
       alert("Error message :"+XMLHttpRequest.responseXML); 
       alert("Error statustext :"+XMLHttpRequest.statusText); 
       alert("Error request status :"+XMLHttpRequest.status); 
     }, 
     complete: function(jqXHR, textStatus){
         alert(textStatus);
     }
      });
  </code></pre>
  
  <p>When I try to run it on the Android Emulator the error messages are:</p>
  
  <pre><code>Error status: error   
  Error type: 
  Error message: undefined
  Error statustext: error
  Error request status: 0
  </code></pre>
  
  <p>However when I try to run it on my Browser (Chrome) with disabled websecurity (because of same origin policy) it works all fine. Phonegap normally shouldn't care about SOP because of the file:/// Protocol. I added the following to 'mobileinit':</p>
  
  <pre><code>$(document).bind("mobileinit", function() {
              $.support.cors = true;
              $.mobile.allowCrossDomainPages = true;
          });
  </code></pre>
  
  <p>But when I run the same Code in Chrome without websecurity disabled, I get exactly the same errors as in the Android Emulator.</p>
  
  <p>I also tried an AJAX call to wikipedia (with html instead of xml, and GET instead of POST), and that worked without a problem.</p>
  
  <p>Also I think the AJAX to Sharepoint doesn't even get fired (no traffic in Fiddler2, if I managed to configure it the right way)</p>
  
  <p>So I am really stuck with this problem since 2 days now, if anyone knows how to make this ajax call work, it would made me so happy :-)</p>
  
  <p>(soapEnv is the XML envelope, sent to the server)</p>