json wcf jquery phonegap work only in .html
in jQuery Mobile
•
10 years ago
My call in phonegap in WP8 to consuming service wcf works only in index.html file. If i call in the .js file i get error GetListaMunicipios was not called.
my call:
$.support.cors = true;
$.mobile.allowCrossDomainPages = true;
$.ajax("http://localhost:56976/MunicipiosService.svc/ListaMunicipios?callback=?",{
beforeSend: function (xhr) {
// $.mobile.showPageLoadingMsg();
alert('beforeSend');
},
complete: function () {
// $.mobile.hidePageLoadingMsg();
alert('complete');
},
contentType: 'application/json; charset=utf-8',
dataType: 'jsonp',
type: 'GET',
crossDomain: true,
cache:true,
jsonp: 'callback',
jsonpCallback: 'GetListaMunicipios',
error: function (xhr, ajaxOptions, thrownError) {
alert('not ok 1 ' + xhr.status);
alert('not ok 2 ' + xhr.responseText);
alert('not ok 3 ' + thrownError);
},
success: function (data) {
alert('success');
}
});
I have no ideia what is wrong because its work in html. Thanks for help
1