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({...});      }); }); 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -