Note that there are some explanatory texts on larger screens.

plurals
  1. POJavaScript ajax is not working
    text
    copied!<p>The following code was showing an ajax updated sql table. The page now loads to a blank table with header rows showing. I'm having a difficult time seeing why this won't render the table. No error is thrown.</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt; &lt;/script&gt; &lt;script&gt; setInterval(function() { refreshTable(); }, sleepTime); /*creates function refreshTable which uses javascript to post data to sqlAjax.php*/ function refreshTable() { sleepTime = 5000; $.ajax({ type: "post", url: "sqlAjax.php", data: $(this).serialize(), success: function(data) { //console.log(data); // "something" updateTable(data); } }); } /*creates function updateTable that appends the body of the table*/ function updateTable(tableData) { $("#priceTable tbody tr").empty(); var $tr = $(tableData); $('#priceTable &gt; tbody:first').append($tr); } &lt;/script&gt; &lt;style type="text/css"&gt; table { width:80%; border-collapse:collapse; } th { background:#95bce2; color:white; font-weight:bold; } td, th { padding:6px; border:1px solid #95bce2; text-align:left; } .even { background-color:#ecf6fc; } .odd { background-color:white; } .hover { background-color:#ccc!important; } .focus { background-color:#6ab9d0!important; color:white; } â &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div span class="span4"&gt; &lt;table id='priceTable'&gt; &lt;thead&gt; &lt;tr&gt; &lt;td&gt;Order ID&lt;/td&gt; &lt;td&gt;Status&lt;/td&gt; &lt;td&gt;Date&lt;/td&gt; &lt;td&gt;DID&lt;/td&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt;&lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

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