Refreshing html table using Jquery Java built on Codeigniter <p>Guys I have a data coming from an outsource table which I'm presenting in table. The original data coming in Json which I'm decoding using PHP function and displaying.</p> <p>I have been googling for auto refreshing that data and found this <a href="http://stackoverflow.com/questions/8128877/auto-refresh-table-without-refreshing-page-php-mysql">Auto refresh table without refreshing page PHP MySQL</a></p> <p>I have managed to built what is suggested in the Ticked answers and seems like working for the first time but it doesn't refresh. So when page is loaded</p> <p>I'm calling this </p> <pre><code>$(document).ready (function () { var updater = setTimeout (function () { $('div#user_table').load ('get_new_data', 'update=true'); /* location.reload(); */ }, 1000); }); </code></pre> <p>Which loads a function named get_new_data from controller file and loads on to</p> <pre><code> &lt;div class="container-fluid" id="user_table"&gt; &lt;/div&gt; </code></pre> <p>Codeigniter controller function is</p> <pre><code> public function get_new_data(){ $url = 'https://gocleanlaundry.herokuapp.com/api/users/'; $result = $this-&gt;scripts-&gt;get_data_api($url); $data_row = $result; $tbl = ''; $tbl .= '&lt;table class="table table-striped table-responsive" id="tableSortableRes"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Name&lt;/th&gt; &lt;th&gt;Email Address&lt;/th&gt; &lt;th&gt;Role&lt;/th&gt; &lt;th&gt;Status&lt;/th&gt; &lt;th&gt;Action&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt;'; foreach($data_row as $row){ $tbl .= '&lt;tr class="gradeX"&gt; &lt;td&gt;' . $row-&gt;name . '&lt;/td&gt; &lt;td&gt;' . $row-&gt;email . '&lt;/td&gt; &lt;td&gt;' . $row-&gt;role . '&lt;/td&gt; &lt;td&gt;&lt;p id="' . $row-&gt;_id. '_status"&gt;'.( $row-&gt;alive == true ? 'Active' : 'Banned').' &lt;/p&gt;&lt;/td&gt; &lt;input id="' . $row-&gt;_id . 'status_val" value="' . $row-&gt;alive . '" type="hidden"&gt; &lt;td class="center"&gt; &lt;a href="#" id="' . $row-&gt;_id . '_rec" onclick="UpdateStatus(' . $row-&gt;_id . ')" class="btn btn-mini "&gt;' . ($row-&gt;alive == '1' ? '&lt;i class="fa fa-thumbs-o-up fa-fw"&gt;&lt;/i&gt;' : '&lt;i class="fa fa-thumbs-o-down fa-fw"&gt;&lt;/i&gt;' ) . '&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; '; } $tbl .= '&lt;/tbody&gt; &lt;/table&gt;'; echo $tbl; } </code></pre> <p>As I said when page loads is showing data so something is working but when I add new data to the database is doesn't automatically show up. I want function to call and refresh the data. Sorry I'm very new to javascript and jQuery so please go easy on me :)</p> <p>Thank you guys</p>