Setting multiple choices using jquery chosen pluging
$('#ShopId').val(array).trigger('chosen:updated');
$('#btnshop').click(function() {
$('#ShopId').chosen('destroy').val(["shop1", "shop2", "shop3"]).chosen();});
$.ajax({
url: 'CustomerReport/GetAllShop',
data: {},
success: function (data) {
var array = [];
$(data.data).each(function (index, car) {
array.push(car.ShopID);
});
$('#ShopId').val(array).trigger('chosen:updated');
},
error: function () {
alert('An error occured try again later');
}
});
Comments
Post a Comment