I have a small web application that manages some lessons and reports the statistics for them (completed and not completed). When one clicks on the .finish
button, I would like to refresh the statistics div
of the lessons.
Here is the php
file:
<?php
include_once('config_mysql.php');
$data = new MysqlClass();
$data->connect();
$sql = "select * from Lessons";
$result = mysql_query($sql);
<div class="history">
while($row = mysql_fetch_array($result)) {
<div>
<h2>name: <?php echo $row['name']; ?>
<h2>completed: <?php echo $row['completed']; ?>
</div>
}
</div>
?>
And the event handler attached to the .finish
class:
$(document).ready(function () {
$('.finish').click(function(event){
completeLesson();
$.ajax({
type: "POST",
url: "statistic.php",
success: function(html){
}
});
}
}
I did not include the completeLesson()
function (which also makes an AJAX call) because it is not important.
I would like to refresh the statistics of lessons without refreshing the page. I tried to refresh it with an AJAX call but it did not update the data. Thank you in advance for your answers.