I'm having a problem referencing a global variable inside an object literal:
function f() {
globalVar = "test";
}
$(document).ready(function() {
f();
var a = $("#id").autocomplete({
lookup: globalVar //says globalVar is undefined
});
$("#button").click(function() {
alert(globalVar); //works
});
});
How can I set the value of lookup to globalVar?
globalVarwould be defined in thealert(), but undefined for the property value assignment.