Send formData with Jquery Datatables ajax
Send formData with Jquery Datatables ajax
warheat1990
Posts: 4Questions: 2Answers: 0
So I'm using Jquery Datatables plugin in my project, I need to send formData and process it as my datatables source, however I have no idea how to get it working by using built in datatables ajax call. Here's my code :
$('#fDataSales').on('change', function () {
var formData = new FormData($('#frmDataSalesUpload')[0]);
$('#tblPreviewDataSales').DataTable({
ajax: {
url: '/DataSales/UploadPreview/',
type: 'POST',
data: formData
}
});
});
My MVC Controller :
public void UploadPreview()
{
if (Request.Files.Count > 0) //always 0
{
//do something
}
}
This discussion has been closed.
Answers
bump