I am using the jQuery user interface autocomplete function. I can get it to work with an example presented using jQuery UI, like this:
var availableTags = [ "ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme" ]; $("#tags").autocomplete({ source: availableTags });
It works without a problem. But I need to use JSON as a data source, which can be obtained as follows: http: //mysite.local/services/suggest.ashx? Query = ball
If I go to this URL, I will return the JSON as follows:
[{"id":12,"phrase":"Ball"},{"id":16,"phrase":"Football"},{"id":17,"phrase":"Softball"}]
How to use a URL as a data source?
I tried to change the original parameter as follows:
$("#tags").autocomplete({ source: "http://mysite.local/services/suggest.ashx" });
But that does not help. I believe that the service does not know which keyword was entered in the input field or so?
Any pointers would be great.