Skip to content

Instantly share code, notes, and snippets.

@bryckbost
Created June 30, 2009 02:53
Show Gist options
  • Save bryckbost/137957 to your computer and use it in GitHub Desktop.
Save bryckbost/137957 to your computer and use it in GitHub Desktop.
$('#search-submit').click(function(event){
event.preventDefault();
$.ajax({
type: 'GET',
url: '/companies/autocomplete.js',
data: 'q='+$('input#search').val(),
dataType: 'json',
success: function(msg){
for(var i=0; i < msg.length; i++) {
$('#company_suggestions').append('<li><input type="checkbox" name="dispute[company_ids][]" value="'+msg[i].company.id+'" id="dispute_company_'+msg[i].company.id+'" /> <label for="dispute_company_'+msg[i].company.id+'"><strong>'+msg[i].company.name+'</strong>: '+msg[i].company.description+'</label></li>')
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment