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();
});
};
:
$("#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.