Logging sent data in an ajax request

I've got my code like this

$.ajax({
    type: 'POST',
    url: '',
    contentType: 'application/json; charset=utf-8',
    data: { Name: name, TableData: tableData },
    dataType: 'json'
});

It's just a simple name string, and an array of data from a table

But when I send this to the controller, how can I display the data sent in a log in visual studio or something?

Thank you.

Answers 1

  • Turn your data into a variable and log that like this:

    var data = { Name: name, TableData: tableData };
     $.ajax({
         type: 'POST',
         url: '',
         contentType: 'application/json; charset=utf-8',
         data: data,
         dataType: 'json'
     });
    console.log(data);
    

Related Articles