Quote: Hi, Everybody I need to call a jquery popupform function inside the onclick event tag a using ASP.NET MVC, Every thing is looking fine but when I click on the btn add new the jquery popupform function dose not open and also the return json data dose not execute Please have a look to my code and reply the missing error Thanks
@{ ViewBag.Title = "Employee List"; } <h2 class="mt-3">Employee List</h2> <a id="btnclick" class="btn btn-primary mb-2 ml-2" style="color:white" onclick="Popupform('@Url.Action("AddOrEdit","Employee")')"> class="fa fa-plus"> Add New</a> <table id="TableEmployee" class="table table-striped table-bordered w-100" > <thead> <tr> <th>Name</th> <th>Position</th> <th>Office</th> <th>Age</th> <th>Salary</th> </tr> </thead> </table> <link href="https://cdn.datatables.net/1.10.16/css/dataTables.bootstrap4.min.css" rel="stylesheet" /> <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" /> @section scripts{ <script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/1.10.16/js/dataTables.bootstrap4.min.js"></script> <script type="text/javascript"> $(document).ready(function () { var popup, datatable; datatable = $("#TableEmployee").DataTable({ "ajax": { "url": "/Employee/GetData", "type": "GET", "datatype": "Json" }, "columns": [ { "data": "Name" }, { "data": "Position" }, { "data": "Office" }, { "data": "Age" }, { "data": "Salary" } ], "Language": { "TableEmployee": "No data found, Please click on Add New Button" } }); $(".btn.btn-primary").click(function () { alert('Hello this is jquery btn'); function Popupform(url) { var formDiv = $('div/'); $.get(url) .done(function (response) { formDiv.html(response); popup = formDiv.dialog({ autoOpen: true, resizable: false, title: 'Fill Employee Details', height: 500, width: 700, close: function () { popup.dialog('destroy').remove(); } }); }); } }); }); </script> }
[HttpGet] public ActionResult AddOrEdit(int id=0) { return View(new Employee_tb()); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)