Hello, I'm trying to do this:
$(document).bind("mobileinit", function() {
$.getJSON('./test-data/global.json', function(data) {
// These assignments do not work.
$.mobile.loadingMessage = data.i18n.loadingMsg;
$.mobile.pageLoadErrorMessage = data.i18n.pageLoadErrorMsg;
// These assignments work.
$.mobile.page.prototype.options.backBtnText = data.i18n.backButtonLbl;
$.mobile.dialog.prototype.options.closeBtnText = data.i18n.closeButtonLbl;
});
});
The last 2 assignments work, but the first 2 do not. However, if I move the first 2 assignments outside of the $.getJSON and set them to arbitrary string literals, they will be properly assigned. The problem is, I need the data from the JSON file to know what to assign the labels.
The above code is included in a script between the jQUery and jQuery Mobile script tags. It must be something about the initialization time it takes to retrieve the JSON. Is there any way to make this work?
Thanks.