I made my ajax request in synchronous mode not in asynchronous mode. Will this below code is okay? Will this cause any issue on the page?
Or else, Give me some idea how to make ajax request to store values in a variable.
var myPage = myPage || {};
myPage.datas = (function(){
var myvar='';
$.ajax({
async: false,
type:'GET',
url: 'JSON/carousel-data.json',
dataType: "json",
success: function(data) {
myvar = data;
}
});
return myvar;
})();