I'm trying to do an ajax call as following:
(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.
};
} )();
meta tag:
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src: 'self' 'unsafe-inline' 'unsafe-eval'">
The errors Visual studio is giving me is as followning:
Unrecognized Content-Security-Policy directive 'script-src:'.
index.html (4,0)
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.
jquery-1.11.3.js (9626,29)
Failed to load resource
jquery-1.11.3.js (9665,29)
It worked for me 20 minutes ago but before that i had a different problem that i solved Old Qestion and now I'm sitting here with this problem instead.
Somethings that i have tried
Building it via AdobePhoneGap builder instated of building it via visual studio
try it on emulator (This works for some reason)
Additional info and ides after some testing
The problem only seems to happen on android devices and not on emulators can there be something wrong with my android phone?