0

I am trying to get a table data using ajax call in ASP.NET MVC, I am getting data but column which has Date datatype is showing a value like /Date(1489257000000)/.

How to convert this in date format?

This is code of my ajax call:

$('document').ready(function () {
    LoadData();
});

function LoadData() {
    $.ajax({
        url: "/Order/List",
        type: "GET",
        contentType: "application/json;charset=utf-8",
        dataType: "json",

        success: function (result) {
            var html = '';
            //var date = new Date(parseInt(jsonDate.substr(6)));
            $.each(result, function (key, item) {
                html += '<tr>';
                html += '<td>' + item.OrderNo + '</td>';
                html += '<td>' + item.NoOfItems + '</td>';
                html += '<td>' + item.TotalPrice + '</td>';
                html += '<td>' + item.SubmittedOn + '</td>';
                html += '<td> <a href="#" onclick="return getbyID(' + item.OrderId + ')">Edit</a> | <a href="#" onclick = "Delele(' + item.OrderId + ')">Delete</a></td>';

                html += '</tr>';
            });

            $('.tbody').html(html);
        },

        error: function (errormessage) {
            alert(errormessage.responseText);
        }
    });
}
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
learner1
  • 116
  • 1
  • 15
  • 2
    Possible duplicate of [ASP.NET MVC JsonResult Date Format](https://stackoverflow.com/questions/726334/asp-net-mvc-jsonresult-date-format) – Tamim Al Manaseer Aug 30 '17 at 10:28
  • Be an awful lot easier if you just return a formatted date string in the controller method –  Aug 30 '17 at 10:54

0 Answers0