javascript - Initilization of Datatables for jQuery Returning Blank Page -


using initilization guide datatables.net, no matter changes i've tried page returned empty. i've tried hosting files rather using cdn, updating recent versions of jquery, , searching haven't seen else error.

<!-- datatables css --> <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.9/css/jquery.datatables.css">  <!-- initialising datatables --> <? $(document).ready(function(){ $('#tabledataset').datatable(); }); ?>  <table id="tabledataset" class="display">     <thead>         <tr>             <th>column 1</th>             <th>column 2</th>         </tr>     </thead>     <tbody>         <tr>             <td>row 1 data 1</td>             <td>row 1 data 2</td>         </tr>         <tr>             <td>row 2 data 1</td>             <td>row 2 data 2</td>         </tr>     </tbody> </table>  <!-- jquery -->    <script src="/assets/plugins/dashboard/jquery-1.10.2.min.js" type="text/javascript"></script>  <!-- datatables --> <script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.9/js/jquery.datatables.js"></script> 

you have wrapped jquery onready function inside php open-end tags. try changing proper tag <script></script>. also, if load javascript files @ bottom of page, have append functions after them.

changing current code 1 solves problem (jsfiddle):

<!-- jquery -->    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>  <!-- datatables --> <script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.9/js/jquery.datatables.js"></script>  <!-- initialising datatables --> <script type="text/javascript">     $(document).ready(function(){         $('#tabledataset').datatable();     }); </script> 

Comments