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

Popular posts from this blog

How to use DbFunctions.TruncateTime

Provision AWS EC2 Instance and RDS with Terraform, and Deploy Spring Boot App to EC2 Instance via GitHub Action Pipeline

Microsoft Access Connectivity from C#