Reputation: 63
Here is the Code
var dataStore = (function () {
var _0x68ccx52;
$['ajax']({
type: 'GET',
url: 'xml/langSelectionsBeta.xml',
dataType: 'xml',
success: function (_0x68ccx2c) {
alert("success");
_0x68ccx52 = _0x68ccx2c;
}
});
return {
getXml: function () {
if (_0x68ccx52) {
return _0x68ccx52;
}
else{
alert("FAIL");
return _0x68ccx52;
}
}
};
})();
var data = dataStore['getXml']();
Data can always be loaded except refreshing the whole page; "FAIL" is always shown before "success". Is there any methods for page refreshing?
Upvotes: 1
Views: 141
Reputation: 63
$['ajax']({
type: 'GET',
url: 'xml/langSelectionsBeta.xml',
dataType: 'xml',
success: function (data) {
dataStore.getXml = function () {
return data;
};
//function that you want to do after receiving the data
//eg. setLanguage(_0x68ccx10);
}
});
Upvotes: 1