[jQuery] Re: Variable Scope Help

2009-08-27 Thread James
Oh, the reason I used a function instead of: extraParams: {catID:categoryID}, is because the function acts as a callback that will execute right before the AJAX call to get the updated data for categoryID, otherwise it will just be the same as the URL, set only on initialization (which is blank).

[jQuery] Re: Variable Scope Help

2009-08-27 Thread James
It's not really a variable scope problem. You're misunderstanding when variables are set. This is what's happening: set global variable categoryID add change event add autocomplete with URL set to aloha/item_search/"+categoryID -> categoryID is blank do rest of page When you do your change e

[jQuery] Re: Variable Scope Help

2009-08-27 Thread James
I haven't tested this, nor tried it before, but based on the documentation the data type of extraParams has to be an object, or a function (that probably returns an object). function getCategoryID() { return {catID:categoryID}; // 'catID' will be the name of the categoryID in your script

[jQuery] Re: Variable Scope Help

2009-08-27 Thread WhoButSB
Thank you James for the help! I didn't know that the address is static once you've initialized it. I'm trying to work with the extraParams option but it doesn't seem to do anything. Here is how I have it set: //Item Search for food name $("#add-item #ITEMNAME").autocomplete("", {