I have the following code:
$(document).ready(function () {
var english = "";
var spanish = "";
$.get("./gamelist-english.txt",function(data){
english = data;
});
$.get("./gamelist-spanish.txt",function(data){
spanish = data;
});
$('#compare').mergely({
cmsettings: { readOnly: true, lineNumbers: true },
lhs: function(setValue) {
setValue(english);
},
rhs: function(setValue) {
setValue(spanish);
}
});
});
(by the way, I'm using mergely library here, but I don't think this matters)
The problem I have is that both variables, "spanish" and "english", are not global, so $('#compare').mergely can't get their values (it says they're both empty, but that's not true). How can I fix this? I thought that by declaring any variables outside of any function they are automatically made global, but apparently that's not working, or I'm a bit lost.
Thank you very much.