I am using the autocomplete jquery json but it is not showing the result. There is following code I am using.
$(function() {
$( "#course" ).autocomplete({
source: function( request, response ) {
$.ajax({
url: "ajax.php",
dataType: "json",
data: {
style: "full",
maxRows: 20,
name_startsWith: request.term
},
success: function( data ) {
response( $.map( data.geonames, function( item ) {
return {
Id: item.Id + (item.FirstName ? ", " + item.LastName : "") + ", " + item.Email,
value: item.Id
}
}));
}
});
},
minLength: 2,
select: function( event, ui ) {
log( ui.item ?
"Selected: " + ui.item.label :
"Nothing selected, input was " + this.value);
},
open: function() {
$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
},
close: function() {
$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
}
});
});
</script>
Ajax案卷采用了这一格式。
[{"Email":"[email protected]","FirstName":"Sobha","Id":12333,"LastName":"Marati"}]