2013-02-16 59 views
0

我试图执行AJAX完整的事件里面的一些代码,但它不会在页面加载事件工作后不执行,但它完美的作品在Onchange链接事件代码jQuery的AJAX完整的事件

$(document).ready(function() { 
    $.ajax({ 
     beforeSend: function() { 
     // Handle the beforeSend event 
     }, 
     complete: function() { 
      // Handle the complete event 
      $("#customfields_1 :input").filter(function() { 
       return $.trim(this.value).length === 0; 
      }).closest("td").hide(); 
     } 
     // ...... 
    }); 
}); 
+3

可能是因为你缺少一个URL请求发送到? – adeneo 2013-02-16 01:57:13

+0

@adeneo它不会在页面加载事件工作,但它完美的作品在Onchange链接事件 – user2077308 2013-02-16 01:59:12

+0

@adeneo你能更具体 – user2077308 2013-02-16 02:00:05

回答

0
$(document).ready(function() { 
    $.ajax({ 
     url: 'http://foo.bar.com/some.json', // this is the important part 
     beforeSend: function() { 
     // Handle the beforeSend event 
     }, 
     complete: function() { 
      // Handle the complete event 
      $("#customfields_1 :input").filter(function() { 
       return $.trim(this.value).length === 0; 
      }).closest("td").hide(); 
     } 
     // ...... 
    }); 
});