开发者

jquery ajax start handler not firing

开发者 https://www.devze.com 2023-03-28 05:34 出处:网络
jquery ajax start handler not firing. Why? jquery 1.6.2 Code example: $(document).ready(function(){ $(\'#rr-loading-overlay\').ajaxStart(function(){

jquery ajax start handler not firing. Why? jquery 1.6.2

Code example:

$(document).ready(function(){
 $('#rr-loading-overlay').ajaxStart(function(){
  alert('asda'开发者_如何学编程);
 }).ajaxStop(function(){

 });

 $.ajax({
    type: "GET",
    url: 'service.com',
    crossDomain: true,
    dataType: "json",
    success: function(data) {
     formatData(data);
    },
    error: function(jqXHR, textStatus, errorThrown) {
     alert(textStatus + ' / ' + errorThrown);
    }
 });

    function formatData(data){
 }

})

also i tried and nothing.

 $(document').ajaxStart(function(){
   alert('asda');

     })


It works for me

Working demo


I had run into same problem. What worked for me was binding ajaxStart before making any AJAX request

0

精彩评论

暂无评论...
验证码 换一张
取 消