I'm trying to show the contents of a php in a modal using a js but nothing appears I have the following JS that what it tries to do is send the AJAX variable to the PHP and the result of this would be shown in the modal
$.ajax({
url: "table.php",
data: {AJAX: table},
type: "POST",
success: function(data)
{
$('#modal').show();
$('#modal-body').show().html(data);
}
});
The content of the PHP is as follows:
<?php
if(isset($_POST['AJAX'])) {
$name = $_POST['AJAX'];
}
echo $name;
?>
The content of the modal is as follows:
<div class="modal fade" id="modal">
<div class="modal-body">
<!-- load content table.php -->
</div>
</div>
What's wrong with me and what should I do to solve it? thanks!