Ajax error

Ajax error

SmudgerSmudger Posts: 2Questions: 1Answers: 0
edited May 2017 in Free community support

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:

Failed to load resource:
http://127.0.0.1:8000ue%5D=&columns%5B6%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B7%5D%5Bdata%5D=Status&columns%5B7%5D%5Bname%5D=&columns%5B7%5D%5Bsearchable%5D=true&columns%5B7%5D%5Borderable%5D=false&columns%5B7%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B7%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B8%5D%5Bdata%5D=Division&columns%5B8%5D%5Bname%5D=&columns%5B8%5D%5Bsearchable%5D=true&columns%5B8%5D%5Borderable%5D=false&columns%5B8%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B8%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B9%5D%5Bdata%5D=Assignee&columns%5B9%5D%5Bname%5D=&columns%5B9%5D%5Bsearchable%5D=true&columns%5B9%5D%5Borderable%5D=false&columns%5B9%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B9%5D%5Bsearch%5D%5Bregex%5D=false&order%5B0%5D%5Bcolumn%5D=0&order%5B0%5D%5Bdir%5D=asc&start=0&length=10&search%5Bvalue%5D=&search%5Bregex%5D=false&datagrid=Datagrid&_=1495887698421?_=1495887698421&columns%5B6%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B7%5D%5Bdata%5D=Status&columns%5B7%5D%5Bname%5D=&columns%5B7%5D%5Borderable%5D=false&columns%5B7%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B7%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B7%5D%5Bsearchable%5D=true&columns%5B8%5D%5Bdata%5D=Division&columns%5B8%5D%5Bname%5D=&columns%5B8%5D%5Borderable%5D=false&columns%5B8%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B8%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B8%5D%5Bsearchable%5D=true&columns%5B9%5D%5Bdata%5D=Assignee&columns%5B9%5D%5Bname%5D=&columns%5B9%5D%5Borderable%5D=false&columns%5B9%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B9%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B9%5D%5Bsearchable%5D=true&datagrid=Datagrid&length=10&order%5B0%5D%5Bcolumn%5D=0&order%5B0%5D%5Bdir%5D=asc&search%5Bregex%5D=false&search%5Bvalue%5D=&start=0&ue%5D=

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.

Answers

  • kthorngrenkthorngren Posts: 21,363Questions: 26Answers: 4,956

    the server responded with a status of 404 (Not Found)

    The place to start is to review the server logs to find out why its responding with 404 Not Found.

    Kevin

  • joakimvfjoakimvf Posts: 9Questions: 2Answers: 0

    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: '..'
    },

  • SmudgerSmudger Posts: 2Questions: 1Answers: 0

    You should try to use POST on your table.
    I have done this already through symfony using the code below:

    $qb->andHaving('t.status = 0');
                return $this->render('AppBundle:Portal/Helpdesk:closed.html.twig', array(
                    'grid' => $grid,
                    'tickets' => $qb->getQuery()->getResult()));
    
  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    How does that code relate to the code in your original post?

    And have you checked your server logs as Kevin advised?

  • allanallan Posts: 63,552Questions: 1Answers: 10,477 Site admin

    The URL being request looks very very odd. Can you show the client-side code? Have you set the ajax option?

    Allan

This discussion has been closed.