varGetidnamelist =function (list, selected, text, BTN, ActionURL, Defaultkey, DeleteKey, KeyName, ValueName, callbackfuc) {Btn.bind ("Click KeyUp", {Stext:text}, function (e) {$.ajax ({url:actionurl, ContentType:"Application/json", type:"GET", Success: $.proxy (function (data) {varComparstr = This. Val (); for(vari =0; i < data.length; i++) { if(Data[i][valuenamestr].indexof (COMPARSTR) = =-1) Continue; }}, E.data.stext)}); });}//calledvarI=1; Getidnamelist ($ ('#List'+i), $ ('#S'+i), $ ('#searchText'+i), $ ('#searchBtn'+i),".. /scripts/a04/a0410.json", NULL,NULL,"Key","Value", function (obj) {}); //HTML<divclass="Btn-group"> <button type="Button" class="btn Btn-default Dropdown-toggle"data-toggle="dropdown"Aria-expanded="false"> <span data-bind="attr:{id: ' S ' + $index ()}"> Please select </span><spanclass="Caret"></span> </button> <ulclass="Dropdown-menu"role="Menu"Data-bind="attr:{id: ' List ' + $index ()}"></ul> <divclass="Input-group"> <input type="text" class="Form-control"Data-bind="attr:{id: ' SearchText ' + $index ()}"Placeholder="Professional category name"> <spanclass="input-group-btn"> <buttonclass="btn Btn-primary"Id="c2-searchbtn"Data-bind="attr:{id: ' searchbtn ' + $index ()}"Type="Button">Search</button> </span> </div></div>//A0410.JSON[{ "Key":"1", "Value":"Philosophy"},{ "Key":"101", "Value":"Philosophical Class"},{ "Key":"10101", "Value":"Philosophy"},{ "Key":"10102", "Value":"Logic"}]
A more perverted JS transfer value, query bind, Ajax closure, the value of the