3
I have doubts how to use Datatables with MVC 5 and with Submit button returning a Json as per the site: Datatables
$(document).ready(function() {
$('#example').dataTable( {
"processing": true,
"serverSide": true,
"ajax": {
"url": "scripts/post.php",
"type": "POST"
},
"columns": [
{ "data": "first_name" },
{ "data": "last_name" },
{ "data": "position" },
{ "data": "office" },
{ "data": "start_date" },
{ "data": "salary" }
]
} );} );
- Use MVC and not php
- How should I place the MVC Actionresult call and return a JSON as the component waits.
I wanted to put fields to filter example Address Name and descend to the controller that two fields and make a call to database returning result that do not know how to convert to Json that component expects:
{ "draw": 1, "recordsTotal": 57, "recordsFiltered": 57, "data": [ { "first_name": "Airi", "last_name": "Satou", "position": "Accountant", "office": "Tokyo", "start_date": "28th Nov 08", "salary": "$162,700" }, { "first_name": "Cedric", "last_name": "Kelly", "position": "Senior Javascript Developer", "office": "Edinburgh", "start_date": "29th Mar 12", "salary": "$433,060" } ] }
Please create a title that briefly describes your problem. The tags should not be used as a title.
– Maniero
http://www.codeproject.com/Articles/155422/jQuery-DataTables-and-ASP-NET-MVC-Integration-Part
– Dorathoto