Hi
I have below controller & JS. I want to refresh datatable after Add & display message in popup
" style="width:100%" id="tblLocation">
- @Html.DisplayNameFor(model => model.Id)
- @Html.DisplayNameFor(model => model.Description)
- @Html.DisplayNameFor(model => model.IsActive)
Action - @foreach (var item in Model)
- {
- @Html.DisplayFor(modelItem => item.Id)
- @Html.DisplayFor(modelItem => item.Description)
- @Html.DisplayFor(modelItem => item.IsActive)
- class='btn btn-primary btn-sm' id='btnEdit'>class='fa fa-pencil'> Edit
- class='btn btn-danger btn-sm' id='btnDelete' style='margin-left:5px'
- @{ if(item.IsActive == "N")
- {
- @:disabled="disabled"
- }
- }>class='fa fa-trash'> Delete
- }
- function Add() {
- var res = validate();
- if (res == false) {
- return false;
- }
- var objLocation = {
- Id: $('#txtId').val().toUpperCase(),
- Description: $('#txtDescription').val().toUpperCase(),
- IsActive: $('#txtIsActive').val().toUpperCase()
- };
- $.ajax({
- url: "/Location/Add",
- data: JSON.stringify(objLocation),
- type: "POST",
- contentType: "application/json;charset=utf-8",
- dataType: "json",
- success: function () {
- $.notify(result.message, {
- globalposition: "top center",
- //position:"center",
- className:"success"
- })
- $('#myModal').modal('hide');
- },
- error: function (xhr, ajaxOptions, thrownError) {
- $("#msgModalBody").html('Status : ' + xhr.status + ' Error : ' + thrownError);
- $("#msgModal").modal('show');
- }
- });
- }
Thanks
Sachin SinghPosted Jun 2, 2021, 1:01 PM
Ramco RamcoPosted Jun 2, 2021, 12:34 PM
Jignesh KumarPosted Jun 2, 2021, 11:54 AM