json wcf jquery phonegap work only in .html

json wcf jquery phonegap work only in .html

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;


beforeSend: function (xhr) {

// $.mobile.showPageLoadingMsg();



complete: function () {

// $.mobile.hidePageLoadingMsg();



contentType: 'application/json; charset=utf-8',

dataType: 'jsonp',

type: 'GET',

crossDomain: 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) {




I have no ideia what is wrong because its work in html. Thanks for help