Autocomplete on content refresh

Autocomplete on content refresh

I have a array[] of strings that prefills my autocomplete widget:

var array = [<values prefilled from server>];
$(function(){
      $( ".urlInput" ).autocomplete({
        source: array
    });
})






and everything works fine.

On the page, there is an option that allows the user to add the values via AJAX that get inserted into the datasource that prefilled array.  After the successful AJAX request/response, I am trying to update the source of the autocomplete widget with the new value the user added.

- I have tried simply resetting the source: $(".urlInput").autocomplete( "option", "source", availableTags);

- I have tried destroying the autocomplete ($(".urlInput").autocomplete("destroy");) and recreating it again.

- I have tried creating the autocomplete new from AJAX everytime before it is "enabled".

- And many other hacks

In all of these cases, the widget simply stops working after I mess with it.  No console errors or nothing.  Is there something I am missing?  Do I need to do some kind of unbind and rebind to the jQuery selector (even though, I pretty much did it)?  Any other suggestions?

Thank you.