I have the following data on http://www.abcd.com/friends.json (this is not a real link but I am using one that is real on my project and I can connect to the server):
{John, Kyle, Abby, Greer, Rob, Cathy}
and I have the following script to autocomplete a text field:
$(function() {
$("input#autocomplete").autocomplete({
source: $.getJSON("http://www.abcd.com/friends.json")
});
});
or
$(function() {
var friendList = null;
$.getJSON("http://www.abcd.com/friends.json", function(data){
friendList = data;
$("#friend" ).autocomplete({
source: friendList
});
});
});
what am I doing wrong? both codes work if the json object is not called from a remote server Thanks for helping.