jquery autocomplete gives error over 2000 data

phanquoctoan

New Member
I want to use jquery autocomplete. I have 5509 datas in my string[]. It falls error when I try to use all of them. But when I take 2000 datas everything is ok. Here is my javascript code:\[code\]<script type="text/javascript"> $(document).ready(function () { $(document).ready(function () { var availableSizes = []; $(document).ready(function () { $.ajax({ type: "POST", url: "WebForm1.aspx/GetProductNameList", data: '{}', contentType: "application/json; charset=utf-8", dataType: "json", success: function (msg) { if (msg.d != null) { availableSizes = msg.d; alert(availableSizes); } }, error: function (msg) { alert('hata' + msg); } }); }); function split(val) { return val.split(/,\s*/); } function extractLast(term) { return split(term).pop(); } $("#tags") // don't navigate away from the field on tab when selecting an item .bind("keydown", function (event) { if (event.keyCode === $.ui.keyCode.TAB && $(this).data("autocomplete").menu.active) { event.preventDefault(); } }) .autocomplete({ minLength: 0, source: function (request, response) { // delegate back to autocomplete, but extract the last term response($.ui.autocomplete.filter( availableSizes, extractLast(request.term))); }, focus: function () { // prevent value inserted on focus return false; }, select: function (event, ui) { var terms = split(this.value); // remove the current input terms.pop(); // add the selected item terms.push(ui.item.value); $('input[type=checkbox]').each(function () { if (ui.item.value =http://stackoverflow.com/questions/12784581/= $("label[for=" + this.id + "]").text()) { $("label[for=" + this.id + "]").css("color", "green"); this.checked = true; } }); // add placeholder to get the comma-and-space at the end terms.push(""); this.value = http://stackoverflow.com/questions/12784581/terms.join(", "); return false; } }); }); });</script>\[/code\]Do you have any suggestion?
 
Back
Top