I'm making a social network website where the users can confirm and cancel their attendance to a certain event. While this is already working, the problem is that every time a user confirm or cancel their attendance, the whole page reloads while I want only the confirmation div to reload.
<!-- The search results are displayed here -->
<div class="col-md-8 col-lg-7" id="vomeio" style="background-color: snow;">
<div class="page-header"><center> <h3> Resultados da pesquisa: </h3></center></div>
<?php include "search.php" ?>
<br><br><br><br>
</div>
</div>
search.php
echo '<div class="container"><img class="pull-left" height="317px" width = "422px" src="home/'.$linha['image'].'"/>';
echo "<p><div id=\"resultado\"><strong>Confirmados: $confirmados</strong></div></p>"; //this is the div I want to reload.
if ($groxa==0) {
echo "<form id=\"resultar\" method=\"post\" action=\"confirm.php?codigo=$codigo\"><p><input type=\"submit\" value=\"Confimar presença\"></p></form>"; //if you havent already confirmed your attendance, this displays the confirm button.
}
confirm.php
//if your attendance is confirmed
print("<script>alert(\"Confirmado com sucesso.\")</script>");
print("<meta http-equiv=\"refresh\" content=\"0;searchpage.php\">");
I know the http-equiv part is reloading the whole search page (without the results displayed ofc) but I want only the confirmation div related to the event to update. Is there a way?