Error happening going into 302
Error happening going into 302
Hi, I have the following jquery Code
Now the first ajax call is made properly and i get the headers back, when it reaches the ajax call of datatables i am getting 302.
No log is showing me enough information, I checked IIS logs and my Coldfusion Logs but both are empty, so it seems the issue is not with code.
$(document).on('click', '#Button',function (e) {
e.preventDefault();
$.ajax({
url: "/post.cfm",
cache: false,
data : $('#form').serialize(),
method: "post",
success: function(response){
$('div.results').show();
$('.mytable').show();
$('.mytable').html(response);
}
}).done(function(data) {
$('#datatables').show();
$("#datatables").DataTable({
"bFilter": true,
"serverSide": true,
"deferRender":true,
"processing": true,
"fixedHeader": true,
"scrollX": true,
"columns": [
{ "data": "CustomerName", "title": "Acccount", "autoWidth": true },
{ "data": "flname", "title": "Completed by", "autoWidth": true,"orderable": false }
],
"columnDefs": [
{ width: 120, targets: 0 },
{ width: 90, targets: 1 }
],
"fixedColumns": true,
"ajax": {
"url" : "/post_submit.cfm",
"type" : "POST",
"data": function (d) {
return $.extend({}, d, {
"DateS": $('#DateS').val(),
"DateX": $('#DateX').val(),
"ticketType":$('#ticketType option:selected').toArray().map(function(item) { return item.value; }).join(),
"finalStatus": $("#finalStatus option:selected").toArray().map(function(item) { return item.value; }).join()
});
}
},
"language": {
"processing": '<i class="fa fa-spinner fa-spin fa-3x fa-fw"></i><span class="sr-only">Loading...</span> ',
"emptyTable": "No Data available"
},
"scroller": {
loadingIndicator: true
},
"initComplete" : function () {
$('.dataTables_scrollBody thead tr').addClass('hidden');
}
});
});
When the code goes to post.cfm or post_submit.cfm
Not sure what is going on, what is the best way to track down the error, i am trying everything to atleast show me an error and if it can tell me an error, atleast i can debug but right now, it does even go to that point
please guide
here is the error what i am getting
DataTables warning: table id=datatables - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1
This question has an accepted answers - jump to answer
Answers
As I mentioned in your other thread the problem is with the web server configuration or other server side error. Posting your client code here won't help troubleshoot the problem. The 302 error is not a Datatables issue. You can test with the
curl
command. See this POST with curl tutorial for basic steps.Have you searched sites like Stack Overflow for help with IIS, Coldfusion and 302 errors? Here is one SO thread that talks about Handler Mappings. Maybe that is what you need.
Kevin
i did everything, but i am not getting a small glimpse of an error
not sure what is wrong
As Kevin explained, a 302 is a server error, so it would be worth checking on StackOverflow, as it's not a DataTables issue,
Colin
this is strange, the error is happening when datatables ajax is called, not jquery ajax, so it seems the datatables ajax has something which is not working
Can you link to your page so we can take a look, please?
Colin
Your jQuery ajax is using
"/post.cfm"
while Datatables ajax is using"/post_submit.cfm"
. They are two different URLs so they can't be compared. The configuration in your IIS server for/post_submit.cfm
is causing the 302 response.Have you tried the curl command I suggested to show its not a Datatables issue?
Kevin
i fixed it, due to security, i was missing the csrf token, passed that and it started displaying