I'm using the jQuery UI Autocomplete function. I can make it work with the example provided with 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
});
This works without any problems. But I need to use JSON as my data source who can be retrieved like this: http://mysite.local/services/suggest.ashx?query=ball
If I'm going to that URL I get JSON back like this:
[{"id":12,"phrase":"Ball"},{"id":16,"phrase":"Football"},{"id":17,"phrase":"Softball"}]
How can I use my URL as the data source?
I've tried changing the source-option like this:
$("#tags").autocomplete({
source: "http://mysite.local/services/suggest.ashx"
});
But it doesn't help. I guess that the service doesn't know which keyword has been typed in the input field or so?
Any pointers would be great.