'Refresh table only when modal closes
I have a script that reloads the entire page when modal is closed, I want it to reload just the div that contains the table instead of the entire page.
the div is:
<div class="result_data" id="result_data"> Table here </div>
<script>
$(document).ready(function(){
// use ajax, call the PHP
$.ajax({
url: 'pages/t-log.php', // path of lelong
success: function(response){
$('#result_data').html(response);
}
})
});
</script>
My code is:
<script>
$('#modal-buy, #modal-sell').on('hidden.bs.modal', function () {
location.reload();
});
</script>
I was able to do it using:
$('#modal-buy, #modal-sell').on('hidden.bs.modal', function () {
$('#result_data').load(document.URL + ' #result_data');
//location.reload();
});
but the new challenge is that the ID is already being used to populate the table, so it reloads but doesn't populate the table.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
