I'm trying to make a loading screen using modal and jquery, in that while collecting information from the database, it has to appear loading. But even after it has already loaded, the modal is not disappearing. Here is the code:
<!-- Modal aguarde -->
<div class="modal fade" id="modalaguarde" tabindex="-1" role="dialog" aria-labelledby="modalAguarde" aria-hidden="true">
<div class="modal-dialog modal-aguarde modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="text-center">
<img src="img/carregando.gif" class="modal-img">
<h5>carregando...</h5>
</div>
</div>
</div>
</div>
</div><!-- Fim Modal -->
$(document).ready(function(){
$('.play').click(function(e) {
e.preventDefault();
$.ajax({
url: 'url...',
type: 'post',
data: {},
dataType: 'json',
cache: false,
contentType: false,
processData: false,
beforeSend: function(){
$('#modalaguarde').modal('show');
},success: function(data){
$('#modalaguarde').modal('hide');
}
});
});
});