does not show data in div method jQuery post

-1

I have a problem with jquery post, it does not show result that the ajax returns when it sent the data, I am showing a waiting message, the wait message if it shows it when the waiting message disappears, the browser window goes blank , this code is the one I'm using

            
            var cargando = $("#load").html("Por favor espere...");

            // evento ajax start
            $(document).ajaxStart(function () {
                cargando.show();
            });

            // evento ajax stop
            $(document).ajaxStop(function () {
                cargando.hide();
            });

            $.post("procesaRenovacion.vbhtml", $('#envia').serialize(),
                    
                function (data) {
                    $('#muestraResultado').show();
                    $('#muestraResultado').html(data);
                });

the div where the data should appear hidden when loading the page

<div id="muestraResultado" style="display:none">Hola</div>
    
asked by Drago25 02.03.2016 в 18:09
source

1 answer

0

It happens that these functions apply to all AJAX that you have:

// evento ajax start 
$(document).ajaxStart(function () { cargando.show(); }); 
// evento ajax stop 
$(document).ajaxStop(function () { cargando.hide(); });

Try this:

var cargando = $("#load").html("Por favor espere...");

$.ajax({
type: 'POST',
url: 'procesaRenovacion.vbhtml',
data: $('#envia').serialize(),
beforeSend: function() {      
    cargando.show();  
},
success: function(data) {
  cargando.hide();
  $('#muestraResultado').show();
  $('#muestraResultado').html(data);
}});
    
answered by 02.03.2016 / 18:56
source