3,600 questions
Dear Friends,
After my great research, I got the solution, details as follows,
1. I renamed **Index.cshtml** from groups.cstml
2. Changed **return View("Index");** from return View();
3. in Jquery I removed one } which is wrong, the final one script as follows ...
<script src="~/Scripts/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="http://ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js"></script>
<script type="text/javascript">
$("body").on("click", "#btnAdd", function () {
var txtreg = $("#txtRegion");
var txtbr = $("#txtBranch");
var txtgrid = $("#txtGroupID");
var txtgrname = $("#txtGroupName");
$.ajax({
type: "POST",
url: "/Groups/InsertGroups",
data: '{RegionName: "' + txtreg.val() + '", BranchName: "' + txtbr.val() + '", GroupId: "' + txtgrid.val() + '", GroupName: "' + txtgrname.val() + '" }',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (r) {
txtRegion.val("");
txtBranch.val("");
}
});
});
</script>
Thanks for the support.