I'm trying to get a simple phonegap app to communicate with my server.
This is my javascript:
<script src="js/jquery.min.js" ></script>
<script>
$.ajax({
url: 'http://www.drimmit.com/test',
dataType: 'jsonp',
jsonp: 'jsoncallback',
timeout: 5000,
success: function(data, status){
//data loaded
alert(data);
},
error: function(){
//error loading data
alert('no data');
}
});
</script>
I've also whitelisted the domain in the config.xml:
<access origin="http://www.drimmit.com" subdomains="true"/>
On my server, I'm doing a simple echo statement.
<?php
header('Content-type: application/json');
echo 'hello from server';
?>
In the end, I just get a popup (iOS) saying "no data", meaning it failed.