On your js file, you give that input an event (keypress or anything you want) and when the event triggered you send an ajax post request to your controller method.
On your controller method you read the post request, then do a DB search, you return the result to your js by 'echoing' the DB search result using your preferred format (JSON, xml, etc).
You process the result on your js file using callback.