Datatables works in my local machine but when I publish I have errors
Datatables works in my local machine but when I publish I have errors

Hi all
I'm working in my localhost, (Windows 2008 R2, Visual Studio 2013, c#), I've created a .aspx page with Datatables and all works perfect!.
After publishing in IIS 7, when I try to reach the page from another computer , I had the error:
Datatables warning: table id =datatable - Ajax error. For more information about this error, please see http://datatables.net/tn/7
When I open the Developer Tools (in Chrome) I saw the error:
Failed to load resource: the server responded with a status of 500 (Internal Server Error) (... link to my ajax url)
I've tried to debug my problem but I have no clue about the error, may be someone can help me?
This is my code:
<script type="text/javascript">
$(document).ready(function () {
var table = $('#datatable').DataTable({
bServerSide: true,
sServerMethod: 'post',
sAjaxSource: 'CustomerService.asmx/GetCustomers2',
columns: [
{ data: 'cust_contract_name' },
{ data: 'cust_id' },
{ data: 'cust_name' },
],
});
});
</script>
And here the link of debug datatables: http://debug.datatables.net/agonon
Thanks in advanced
Answers
You'd need to look at the server's error logs. A 500 error just means something went wrong at the server-side - it could be anything!
Allan
Thanks Allan, I found the solution by adding this in my Web.config file:
Problem with the protocol beacuase is disabled by default.
Excellent - thanks for posting back with the solution! Interesting that POST was disabled by default! I'll keep that in mind should anyone else ask about this.
Regards,
Allan
Hi, all masters,
I've problem for the DataTable, when I put them running in my local, its run perfectly. But when I publish and access a database, it appear such error for Datatables warning: table id =datatable - Ajax error. For more information about this error, please see http://datatables.net/tn/7
Look for the console, bring this error : POST http://localhost/Draft/getDraft 404 (Not Found)
I've insert :
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
in the web.config, nothing changed :(
Any idea?
Thanks,
Regards
It sounds like either your routing is not correct or the controller name is not correct or something else. Either way, the Ajax request is 404 so you need to either change the URL that the data is being requested from or update the server to accept a request for that URL.
Allan
shomim,
did you have any luck with this? I am in the same boat.
thanks,
Mike
BTW,
if anyone is wondering:
DataTables debug bookmarklet
Upload complete - debug code: owozed (view)
Please include this debug code in support requests
It appears to show that
/api/salary/al
is 404 not found on your server. Can you access that URL directly using your browser?Allan