user12805845
user12805845

Reputation: 87

Dialog is not a function Popup Form

I am having an issue with opening a popup form when i klick "Add New" button. Here is my Jquery imports:

<script src="~/Scripts/jquery-3.5.0.min.js"></script>
<link href="~/Scripts/DataTable/css/jquery.dataTables.css" rel="stylesheet" />
<script src="~/Scripts/DataTable/js/jquery.dataTables.js"></script>

HTML:

    <a class="btn btn-success" style="margin-bottom: 12px; margin-top: 15px;" onclick="PopupForm('@Url.Action("AddOrEdit","ProductCategory")')"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span>Add New</a>

Jquery:

 function PopupForm(url) {
            var formDiv = $('<div/>');
            $.get(url)
            .done(function (response) {
                formDiv.html(response);

                Popup = formDiv.dialog({
                    autoOpen: true,
                    resizable: false,
                    title: 'Fill Category Details',
                    height: 500,
                    width: 700,
                    close: function () {
                        Popup.dialog('destroy').remove();
                    }

                });
            });
        }

Upvotes: 1

Views: 125

Answers (1)

Anupam Singh
Anupam Singh

Reputation: 1166

Reference Jquery UI and add an html placeholder in dom for Dialog.

Upvotes: 1

Related Questions