I have a HTML structure like:
<label for="supervisors">Assign the Supervisor: </label>
<input class="supervisors"/>
and my Javascript is:
<script type="text/javascript">
jQuery(function() {
jQuery( ".supervisors" ).autocomplete({
source: "/users/autocomplete_for_supervisors",
minLength: 2,
select: function( event, ui ) {
log( ui.item ? "Selected: " + ui.item.value + " aka " + ui.item.id :
"Nothing selected, input was " + this.value );
}
});
});
</script>
and in my co开发者_运维问答ntroller I have added the action for autocomplete_for_supervisors which is working when I gave in the URL as:
http://localhost:3000/users/autocomplete_for_supervisors?term=ar
But when I type something in the input box in my firebug the jquery is excuted and calling the respective function and returning the response in the firebug. But I am not getting the response below in the input box.
How do I get my returned result below in my input text box?
Please provide suggestions.
I think you are usingthe wrong variable names in the function / file that actually retrieves your data.
This is very similar to my problem which got solved: Having problems with jQuery UI Autocomplete
精彩评论