Asp.NET MVC Ajax error

Asp.NET MVC Ajax error

andyk1andyk1 Posts: 2Questions: 0Answers: 0
edited December 2009 in General
Hey,

Could somebody please help with me. im struggling to get datables working using JSON. Ive read
http://datatables.net/forums/comments.php?DiscussionID=678 and
http://datatables.net/forums/comments.php?DiscussionID=932&page=1#Item_0

I have the code set up from these threads but when I try to access the page I get a Save File Dialog bog. itss trying to save the json instead of displaying it.
[code]
{"sEcho":1,"iTotalRecords":2511,"iTotalDisplayRecords":200,"aaData":[{"id":1,"cell":["1","aaaa","001: error(Split LO) ","bbb","11/12/2009 00:00:00",null,null]},{"id":2,"cell":["2","aaaa","001: error(Split LO) ","bbbb","11/12/2009 00:00:00",null,null]},{"id":3,"cell":["3","aaaa","001: error (Split LO) ","bbb","11/12/2009 00:00:00",null,null]},{"id":4,"cell":["4","aaa","001: error (Split LO) ","aa","11/12/2009 00:00:00",null,null]},
{/code]

[code]
$('#example').dataTable({
"bProcessing": true,
"bServerSide": true,
"aoColumns": [
{ "sTitle": "ComplianceIssueDetailId" },
{ "sTitle": "PortfolioTicker" },
{ "sTitle": "ComplianceRule1" },
{ "sTitle": "CUSIP"}],
{ "sTitle": "DateRaised"}],
{ "sTitle": "UserExplanation"}],
{ "sTitle": "UserExplanation"}],
"sAjaxSource": "/ComplianceIssueDetails/PageFilterSort/"
});
[/code]

Thanks,
Andy

Replies

  • allanallan Posts: 61,840Questions: 1Answers: 10,134 Site admin
    Hi Andy,

    Very odd indeed! I've never heard of it trying to save the JSON to a file rather than just using it... What is the MIME-type (or content-type) of the Ajax header (you can find this out using Firebug or similar)? I'd guess that it's sending back something that is causing the browser to tr and save as a file. Something like text/plain should be used.

    Regards,
    Allan
This discussion has been closed.