Problem: Tried reloading results from MySQL in index.php, using JavaScript. But for some reason it didn't work, I followed a stackoverflow answer.
When clicking the ID 'yes', nothing happens. I have defnied the jQuery liberally, and getting 0 errors in console.
Question
What have I done wrong? How do I fix it?
Basically I want the JavaScript to reload / refresh results from mySQL, if there are new ones when you click the ID 'yes'.
echo '<div id="messages">';
while($row = $fetch->fetch( PDO::FETCH_ASSOC )) {
echo
'<div class="background">'.$row['email'].' <span style="margin-left: 10px;"><font color="#ff0000">UNANSWERED</font></span><span id="right"><a href="index.php?recover='.$row['recover_id'].'">Read More</a></span></div><br />
';
}
echo '</div>';
The HTML
<span id="yes">RELOAD</span>
The JS
<script type="text/javascript">
$(document).ready(function(){
$("#yes").click(function(){
$("#message").eq(0).load("index.php");
})
})
</script>
Followed this: Reload MySQL data inside a DIV using Ajax