Ajax error
Ajax error
Smudger
Posts: 2Questions: 1Answers: 0
Hello, I'm getting an Ajax error and can't find out why. Code is below:
$ticketGrid = new Datagrid();
$ticketSource = new DoctrineSource($this->getDoctrine()->getRepository('AppBundle:Ticket'));
$ticketGrid->setDatasource($ticketSource);
$ticketGrid->addColumn("ID", function($row) {
return $row->getId();
}, ['orderable' => true, 'order_field' => 't.id']);
$ticketGrid->addColumn("IC Name", function($row) {
return $row->getCreator();
}, ['orderable' => true, 'order_field' => 't.creator']);
$ticketGrid->addColumn("Created", function($row){
return $row->getCreated();
}, ['orderable' => true, 'order_field' => 't.created']);
$ticketGrid->addColumn("Rank", function($row) {
return $row->getCreator()->getRankString();
});
$ticketGrid->addColumn("Creator", function($row) {
return $row->getCreator();
});
$ticketGrid->addColumn("Title", function($row){
return $row->getTitle();
});
$ticketGrid->addColumn("Messages", function($row){
return count($row->getMessages());
});
$ticketGrid->addColumn("Status", function($row){
return $row->getStatusString();
});
$ticketGrid->addColumn("Division", function($row){
return $row->getDivisionString();
});
$ticketGrid->addColumn("Assignee", function($row){
if (getAssignee() != null) {
return $row->getAssignee();
}else{
return $row = "";
}
});
if ($ticketGrid->isJsonRequest())
{
$order = $ticketGrid->getRequest()->get('order');
$col = $ticketGrid->getColumnByIndex($order[0]['column'])->getOption('order_field');
$dir = $order[0]['dir'];
$ticketSource->getQueryBuilder()->addOrderBy($col, $dir);
}
$Opengrid = $ticketGrid->render();
I am using a symfony framework.
The error I get in the console is:
the server responded with a status of 404 (Not Found)
If someone know why I am getting the error then it would be great if you could tell me whats causing it.
This discussion has been closed.
Answers
The place to start is to review the server logs to find out why its responding with 404 Not Found.
Kevin
I had similiar problem and it turned out to be:
HTTP Error 404.15 - Not Found
The request filtering module is configured to deny a request where the query string is too long.
You should try to use POST on your table.
$('#table').DataTable({
ajax: {
type: 'POST',
url: '..'
},
How does that code relate to the code in your original post?
And have you checked your server logs as Kevin advised?
The URL being request looks very very odd. Can you show the client-side code? Have you set the
ajax
option?Allan