I’m using the jQuery Autocomplete plugin and would like to store all the autocomplete values locally in an array. I’m able to retrieve a comma separated list from a url using jQuery.load() or jQuery.get(). However, I can’t load the data into an array successfully.
Any suggestions on how to get this working? I realize there’s probably a much better way. Any help would be appreciated.
Thanks!
Are you sure that it isn’t working properly, but that you’re not trying to access that variable outside of the async ajax call?
The only way to have immediate access outside of that ajax call is to run it async=false, or to use a timer to wait and check for that value.
If this is the case, look to the docs on the ajax abstractions:
http://api.jquery.com/jQuery.ajax/
Specifically: