jQuery autocomplete return array -
here's code:
$("#input-search").autocomplete({ source: function(request, response) { $.get('employeesearchlist.igx', { name: request.term }, function(data) { response(data.split('\n')); } ); } }); and employeesearchlist.igx returns kind of format.
[{label:"jp fortes", value:"199829"},{label:"jeffrey dante", value:"200507"}] how can view in return?
<li value="199829">jp fortes</li> <li value="200507">jeffrey dante</li>
$("#input-search").autocomplete({ source: function(request, response) { $.get('employeesearchlist.igx', { name: request.term }, function(data) { var html = ""; for(var i=0; < data.length; i++){ html += '<li value="'+data[i].value+'">'+data[i].label+'</li>'; } $("ul").append(html); }); } }); something should trick. may have drill further data object, check what's returned make sure you're looping through right array.
Comments
Post a Comment