我需要在jQuery中创建一个简单的函数,这将在其他几个函数中调用
$(document).ready(function() { function reload_cart() { alert('reload cart called'); } }); $(document).ready(function() { reload_cart(); //i need to call from here. }); $(document).ready(function() { $('a.add_to_cart').live('click',function (e) { reload_cart(); //i need to call from here. }); });
我在firebug中遇到的错误:reload_cart()未定义.