I'm having this rather weird problem i built an app for android using cordova and had ajax call in it and they worked but for some reason after i got a BSoD on my PC all the ajax calls stopped working when i published the app again to my android phone.
My first thought was that Visual Studio did not add the cordova-plugin-whitelist so i did a new project and tried to add the plugin to test if this was the problem, but now when i add the plugin my build fails and the output window shows this Output on pastebin(will expire on 2015-09-07)
The ajax call works on Android emulator and Ripple if cordova-plugin-whitelist is not installed
Javascript:
(function () {
"use strict";
document.addEventListener( 'deviceready', onDeviceReady.bind( this ), false );
function onDeviceReady() {
// Handle the Cordova pause and resume events
document.addEventListener( 'pause', onPause.bind( this ), false );
document.addEventListener( 'resume', onResume.bind( this ), false );
$.ajax({
url: 'https://www.path.com/Controller/Action',
async: false,
type: "GET",
dataType: "json",
beforeSend: function () { $.mobile.loading('show'); },
success: function (DataToFillSelect) {
$.each(DataToFillSelect, function (val, item) {
$('#Select').append(
$('<option></option>').val(item.Value).html(item.Text)
);
});
},
error: function () {
},
complete: function () { $.mobile.loading('hide'); },
})
// TODO: Cordova has been loaded. Perform any initialization that requires Cordova here.
};
function onPause() {
// TODO: This application has been suspended. Save application state here.
};
function onResume() {
// TODO: This application has been reactivated. Restore application state here.
};
} )();
It's just the blank template with an added ajax call onDeviceReady function
If you need anything more from me just ask i'll be here all day :) Thanks for taking your time to help me solve this issue of mine!