if you're doing it all in javascript, .. just make sure you don't have too much data because that is all being loaded in the browser before it will work.
you may want to checkout yahoo's developer tools. they have a really nice library of things like this already made. here's their autocomplete functionality:
Yahoo! UI Library: AutoComplete looks like it supports both local and remote data.