.click and Load data from json file

.click and Load data from json file

extjacextjac Posts: 13Questions: 6Answers: 0
edited October 2014 in Free community support

Hello, how i can i make bellow code works?

<

script type="text/javascript">
$(document).ready(function()
{

//it works

        $('#example').dataTable( {
            "ajax": "data1.json"
        } );
    });

//It does not work

$( "#btnLoadData" ).click(function() 
{
    $.getJSON( "data1.json", function( data ) {

        $('#example').dataTable( {
            "ajax": data 
        } );
    });
});

});

Answers

  • extjacextjac Posts: 13Questions: 6Answers: 0

    anyone please? I am trying to implement a search and pass parameters to datatable.

  • allanallan Posts: 61,723Questions: 1Answers: 10,108 Site admin

    What is data? The data you want to display in the table? In which case use data not ajax.

    Allan

This discussion has been closed.