set a global variable inside a function jquery code example Example: jquery global variable window.varName