I want to fill a jquery array with several names populated from a back end function.
This is the script:
var availableTags = '@Url.Action("PopSearch", "Home")';
$("#searchtxt").autocomplete({
source: availableTags
});
public ActionResult PopSearch()
{
IndustryManager manager = new IndustryManager();
ProductRangeManager manager2 = new ProductRangeManager();
ProductCategoryManager manager3 = new ProductCategoryManager();
IList<Industry> industryList = manager.GetIndustries();
IList<ProductRange> rangeList = manager2.GetAllProductRanges();
IList<ProductCategory> categoryList = manager3.GetAllProductCategories();
For better performace you can prepeare data on the server side and return it in a single array. On the client side it’s pretty simple to modify for using remote datasource:
Update: you can coimbine values like: