Note that there are some explanatory texts on larger screens.

plurals
  1. PODatatables not loading
    primarykey
    data
    text
    <p>I am trying to using datatables Jquery plugin in codeingiter but its not working please help me to debug</p> <p>Heres my controller where I am calling my view:</p> <pre><code> public function show_all_merchants() { $data["query"]= $this-&gt;details_model-&gt;get_mids(); $this-&gt;load-&gt;view('show_merchants_view',$data); } </code></pre> <p>Heres my view: </p> <pre><code>&lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script src="&lt;?php echo base_url(); ?&gt;assets/js/jquery.dataTables.js"&gt;&lt;/script&gt; &lt;script&gt; $(document).ready(function() { $('#example').dataTable ({ 'bProcessing' : true, 'bServerSide' : true, 'sAjaxSource' : 'show_merchant_details', 'iDisplayStart' : 0, 'fnServerData': function(sSource, aoData, fnCallback) { $.ajax ({ 'dataType': 'json', 'type' : 'POST', 'url' : sSource, 'data' : aoData, 'success' : fnCallback, 'cache' : false }); } }); }); &lt;/script&gt; &lt;table cellpadding="0" cellspacing="0" border="0" id="example"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th width="20%"&gt;ID&lt;/th&gt; &lt;th width="25%"&gt;First Name&lt;/th&gt; &lt;th width="15%"&gt;Last Name&lt;/th&gt; &lt;th width="25%"&gt;Email&lt;/th&gt; &lt;th&gt;&lt;/th&gt; &lt;th&gt;&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td colspan="5"&gt;Loading data from server&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>and heres my controller where I am loading the data Here I am loading data tables library:</p> <pre><code> function show_merchant_details() { $this-&gt;datatables -&gt;select('mid, merchant_name, merchant_link,merchant_contact') -&gt;from('merchants') -&gt;add_column('edit', '&lt;a href="store/update/$1" title="Edit"&gt;Edit&lt;/a&gt;', 'id') -&gt;add_column('delete', '&lt;a href="store/delete/$1" title="Delete"&gt;Delete&lt;/a&gt;', 'id'); echo $this-&gt;datatables-&gt;generate(); } </code></pre> <p>Friends show_merchant_details() is wrking properly as i am able to see the output<br> In the view page I am able to see it like Loading data from server ...... (dats it) </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload