View JavaScript:
$(document).ready(function() {
$("input#autocomplete").autocomplete({
source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"]
});
});
I want to call controller action. source:[ call action ]
From jQuery UI site http://jqueryui.com/demos/autocomplete/#remote :
$( "input#autocomplete" ).autocomplete({
source: "mysourceactionhere"
});
If your JS code on the view, you can use:
$( "input#autocomplete" ).autocomplete({
source: '@Url.Action("SourceAction", "SourceController")'
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.