1.7.2.Bootbox plug-in

  • 1.Open package manager console and type: install-package bootbox -version:4.3.0

  • 2.Modify BundleConfig.cs

      bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                                    "~/Scripts/bootstrap.js",
                                    "~/Scripts/bootbox.js",
                                    "~/Scripts/respond.js"));
  • 3.Modify the confirm dialog window

    @section scripts
    {
    <script>
     $(document).ready(function () {
      $("#customers").on("click", "js-delete", function (result) {
       var button = $(this);
       bootbox.confirm("Are you want to delete this customer?", function () {
        if (result) {
         $.ajax({
          url: "/api/customers/" + button.attr("data-customer-id"),
          method: "DELETE",
          success: function () {
           button.parents("tr").remove();
           console.log("sucess");
          }
         });
       };
      });
      });
     });
    </script> 
    }

Last updated