Hello, Im using the JQuery autocomplete plugin (http://docs.jquery.com/Plugins/Autocomplete) .I have an input field called by in my page.The following code works.
<script>
$(document).ready(function(){
somedata = "Core Selectors Attributes Traversing Manipulation CSS Events Exciting Electronic Effects Ajax Utilities".split(" ");
$("#by").autocomplete(somedata);
</script>
Now, when the by input field gets focus,i make an ajax get request which correctly fetches the data which consists of some strings seprated by "\n",and i want to populate the by field with the data received.But calling autocomplete from within $.get does not work, as shown below. Any way to fix this ?
$(document).ready(function(){
somedata = "Core Selectors Attributes Traversing Manipulation CSS Events Exciting Electronic Effects Ajax Utilities".split(" ");
var url = "<some url here>";
$("#by").focus(function(){
$.get(url,function(result) {
$("#by").autocomplete(somedata); //Does not work
$("#by").autocomplete(result.split("\n")); //Does not work
});
});
});
Thank You.