miguelcamargo9's avatar

DataTables

I work with data tables, is a plug -in for the jQuery Javascript library search for pagination and the reports, so far had not presented me problem , because since the driver passed a parameter json format to view and longer , but came a query of eleventhousand records , when so many my method was everything a failure , now I want to load data from an ajax , to display a page loading , but not as I do , because since the view is not as access a file that is in app , attached my code for me help , I hope I manage to understand.

Controller

$data = json_encode($data);
return View::make('DevicesController.list', array('data' => $data));

View #1 (non works with many records)

var dataset = <?php echo $data; ?>;
    $(document).ready(function () {
        $('#example').dataTable({
            "data": dataset

View with ajax

    $(document).ready(function () {
        $('#example').dataTable({
            "ajax": {
                "url": "/app/helpers/helperDevices.php",
                "type": "POST"
            },

helperDevices.php

$data = json_encode($data);
echo $data;

the error at this time is "miapp.com/app/helpers/helperDevices.php" NOT FOUND.

thx for all!

0 likes
4 replies
helmerdavila's avatar
Level 13

In your "url" param in "ajax" you call a Route, not a php file, you first need to declare that route in your routes.php.

Please or to participate in this conversation.