Skip to Content
0
Former Member
Apr 14, 2014 at 03:05 PM

cordova + iPad + oData

37 Views

Hi,

i developed a GUI with jQuery and i consume oData services from Sap Hana.

With Chrome ( --disable-web-security) i have no problem and i can populate my controls with data.

When i create an Xcode / Cordova project, nothing works, the emulator starts but i got troubles when i call oData services. (I can't see details about errors from the emulator).

This is the function i wrote:

function loadSediOperative()

{

var mdl;

$.ajax({

dataType: "json",

url: "http://XXXXXX/services/Soluzione_1/CentriOperativi.xsodata/CentriOperativi?$format=json",

username: "xxx",

password: "xxx",

async: false,

success: function(results)

{

mdl = results;

}

});

return mdl.d.results;

}

Can you help me? I'm getting mental.

I think (but i'm not sure), the problem could be the cross origin trouble.

I tried to use jsonp but i don't know how to configure the server side (is that necessary? I just enabled CORS).

I wrote something like this but no way:

function jsonCallback(result)

{

alert("Result count : " + $(result["d"]["results"]).length);

}

function textjsonp()

{

var url = 'http://xxxxxxxxxxxxx/services/Soluzione_1/CentriOperativi.xsodata/CentriOperativi?$format=json&$callback=jsonCallback';

$.ajax({

url: url,

dataType: 'jsonp',

jsonpCallback: 'jsonCallback'

});

i get from chrome: Uncaught SyntaxError: Unexpected token :

Help me please

Regards,

Lorenzo