I am listing items from SQL in a HTML table <tr>
's and <td>
's. The table is inside a div that is refreshed with jQuery AJAX in every 30
seconds (that is why the div has a unique id). This part works fine. Here is the HTML:
function auto_load()
{
$.ajax({
url: "/folder/content.php",
cache: false,
success: function(data){
$("#live").html(data);
}
});
}
$(document).ready(function(){
auto_load(); //Call auto_load() function when DOM is Ready
});
setInterval(auto_load,30000);
<div id="live">
<table>
<thead>
<tr>
<th>Id</th>
<th>Name</th>
</tr>
</thead>
<tr>
<td></td>
<td></td>
</tr>
<!-- and so on -->
</table>
</div>
Now what I want to do is make each of the clickable, but so that if it is clicked, 1) a GET request is sent to a PHP file indicating which particular was clicked; 2) and only that particular (or content inside that ) is refreshed right after that, not the whole page.
I cannot do it with a regular http link, as that way if a is clicked, the whole page would be reloaded.
As this is where my knowledge is short, maybe someone kind can share me some ideas on how to solve this. Thanks!
</div>