TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ramco Ramco
439
3.4k
544.3k
Error on Ajax Reload
Jun 1 2021 4:52 PM
Hi
On this line i get error - $('#tblLocation').DataTable().ajax.reload();
DataTables warning: table id=tblLocation - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1
@foreach (var item in Model)
{
}
@Html.DisplayNameFor(model => model.Id)
@Html.DisplayNameFor(model => model.Description)
@Html.DisplayNameFor(model => model.IsActive)
Action
@Html.DisplayFor(modelItem => item.Id)
@Html.DisplayFor(modelItem => item.Description)
@Html.DisplayFor(modelItem => item.IsActive)
Edit
Delete
****************************8
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 (result) {
$('#tblLocation').DataTable().ajax.reload();
$.notify(result.message, {
globalposition: "top center",
className:"success"
})
$('#myModal').modal('hide');
},
error: function (xhr, ajaxOptions, thrownError) {
$("#msgModalBody").html('Status : ' + xhr.status + ' Error : ' + thrownError);
$("#msgModal").modal('show');
}
});
}
***************************************
public List<Location> GetAllLocation()
{
List<Location> objLocation = new List<Location>();
using (SqlConnection con = new SqlConnection(cs))
{
con.Open();
SqlCommand com = new SqlCommand("sp_Location", con);
com.CommandType = CommandType.StoredProcedure;
com.Parameters.AddWithValue("@Action", "R");
SqlDataReader rdr = com.ExecuteReader();
while (rdr.Read())
{
objLocation.Add(new Location
{
Id = rdr["Id"].ToString(),
Description = rdr["Description"].ToString(),
IsActive = rdr["IsActive"].ToString(),
});
}
return objLocation;
}
}
Thanks
Reply
Answers (
5
)
Error - Uncaught ReferenceError: HR is not defined at HTMLAnchorE
Passing a string parameter to EF REST API using asp.net core 3.1