source of json in Multiselect jQuery -
i have multiselect of jquery , want source json. took source code autocomplete combobox works, here not work.
my code:
$(document).ready(function () { var warning = $("#message"); $("select").multiselect({ //selectedtext: function (numchecked, numtotal, checkeditems) { // return numchecked + ' of ' + numtotal + ' checked'; //}, source: function (request, response) { $.getjson('http://' + $("[id$='ip']").val() + "/json/auctocomplete.aspx?city=1&term=" + request.term, function (data) { response(data); }); }, select: function (event, ui) { $("#mfr").textcontent = ui.item.id; }, selectedlist: 5, header: "choose 5", click: function (e) { if ($(this).multiselect("widget").find("input:checked").length > 5) { warning.addclass("error").removeclass("success").html("choose 5"); return false; } else { warning.addclass("success").removeclass("error").html(""); } } }); });
i searched, , think there not source property jquery multiselect. take @ http://www.erichynds.com/blog/jquery-ui-multiselect-widget . sure there source property it?
i advice you, first load select json, convert multiselect.
// empty select element: <select></select> // in javascript: $(document).ready(function () { var url = 'http://...'; $.getjson(url,function(result){ $.each(result, function(i, field){ var option = $('<option value="' + field.value + '">' + field.text + '</option>'); $('select').append(option); }); $('select').multiselect({...}); }); });