How to configure ajaxStart ?? I get "...">

AjaxStart () "$ not defined"

<script src="js/jquery/jquery-1.6.js" type="text/javascript"></script>

How to configure ajaxStart ??

I get "$ .ajaxStart is not a function"

function Loader(){
    this.loader = null;

    this.cnstr = function(){
        if(!this.loader){
            this.loader = DOM.div(document.body);
            with(this.loader){
                className = 'loader';
                innerHTML = 'loader';
                style.display = 'none';
            }

            elm_position_center(this.loader);
            $(this.loader).fadeIn(1000);
        }
    };

    this.dstr = function(){
        if(this.loader){
            DOM.rmv(this.loader);
        }
    };
}
var Loader = new Loader();

$.ajaxStart(function(){
    Loader.cnstr();
});

$.ajaxStop(function(){
    Loader.dstr();
});

EDIT:

$. ajaxStart is not a function

window.onload = function(){
    $.ajaxStart(function(){
        Loader.cnstr();
    });

    $.ajaxStop(function(){
        Loader.dstr();
    });
};
+3
source share
4 answers

your jquery file is probably missing or you did not load it correctly

+1
source

it works.

$(document).ajaxStart();
+9
source

, jQuery. :

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
0

:

$("#loadingAnimation").bind({
   ajaxStart: function(){ $(this).show(); },
   ajaxStop: function() { $(this).hide(); }
});

ajaxStart ajaxStop. , .

When jQuery does not execute any Ajax requests and a new request is triggered, it fires the ajaxStart event. If other requests start before the end of the first, these new requests do not raise a new ajaxStart event. The ajaxStop event is fired when the last pending Ajax request is completed and jQuery no longer performs any network activity.

// Thanks to Kevin Brown for reminding me of an example.

0
source

All Articles