[jQuery] autocomplete
[jQuery] autocomplete
I'm using the autocomplete with a plain ajax call. My problem is that
the autocomplete doesn't work unless after I key in a letter, I must
click out of the input box, click back into it then the autocomplete
works.
I assume b/c on the "onkeyup" it calls the ajax call, but doesn't
remeber what value was typed in so the autocomplete doesn't display.
Please help:
here is the ajax call....which does bring the data back correctly:
function parseMessage()
{
var message = req.responseXML.getElementsByTagName("names")[0];
// IF DEFAULT EMAIL SUPPLIED DISPLAY IN autoEmail
if(message.childNodes[0].nodeValue != "null")
{
var data = message.childNodes[0].nodeValue.split(" ");
$("#names").autocomplete(data);
}
}
Here is the input box
<input type="text" name = "names" onkeyup="getNames()" id="names"/>