phonegap上的CORS无法正常工作

I finally got the code working cross domain from my PC to my server via the browser. But moving the code to phonegap it's not working anymore. I've given permission for internet and access origin * so it should be able to access all webpages. What else do I need to enable?

<html>
<head>
<script src="js/jquery-1.11.0.js"></script>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css" />
<script>
    function dologin() {
        var senddata = $('#form').serialize();
        alert(senddata);

        $.ajax({
            type: 'post',
            url: 'XXXXXXXX',
            data: senddata,
            crossDomain: true,
            dataType: 'json',
            success: function(response) {
                if(response.success == true)
                    alert("YAY");
                else
                    alert("NAY");
            },
            error: function(XMLHttpRequest, textStatus, errorThrown) {      
                console.log("Status: " + textStatus); alert("Error: " + errorThrown);
            } 
        });
        return false;
    };
    </script>
</head>
<body>
    <h1>Logg inn</h1>
    <form id="form" onsubmit="return dologin();">
        <div class="form-group">
            <label for="email">Epost</label> <input type="email"
                class="form-control" name="email" value="test@test.no"
                placeholder="Epost">
        </div>
        <div class="form-group">
            <label for="password">Passord</label> <input type="password"
                class="form-control" name="password" value="test"
                placeholder="Passord">
        </div>
        <div class="checkbox">
            <label> <input type="checkbox" name="remember_me">
                Husk meg
            </label>
        </div>
        <button type="submit" class="btn btn-primary">Logg inn</button>
    </form>

    <div class="login-help">
        <p>
            Glemt passordet? <a href="index.html">Trykk her for å endre det</a>.
        </p>
    </div>
</body>
</html>

Try including this line in ajax call

headers: { "cache-control": "no-cache" }

Cross-domain policy does not apply to PhoneGap (for a variety of reasons, basically because your app is essentially running off the file:// URI on-device). So you try by removing the cross domain parameter in ajax call.