Javascript 使用DrupalAddJS调用函数

Javascript 使用DrupalAddJS调用函数,javascript,jquery,drupal-7,Javascript,Jquery,Drupal 7,我正在调试一个drupal模块,第二行drupal_add_js调用uc_.js中的js函数 drupal_add_js(drupal_get_path('module', 'uc_discounts') . '/uc_discounts.js'); drupal_add_js('(function($){jQuery(document).ready(function () { uc_discountsOnLoad(e); })})(jQuery);', array('type' => '

我正在调试一个drupal模块,第二行drupal_add_js调用uc_.js中的js函数

drupal_add_js(drupal_get_path('module', 'uc_discounts') . '/uc_discounts.js');
drupal_add_js('(function($){jQuery(document).ready(function () { uc_discountsOnLoad(e); })})(jQuery);', array('type' => 'inline', 'group' => JS_DEFAULT, 'scope' => 'footer'));
firebug中有一条错误消息,ReferenceError:uc\u折扣SONLOAD未定义,任何人都可以解决问题吗

**更新**

我知道这些问题

如果在(函数($){})(jQuery)外部定义,则uc_折扣SONLOAD;可以调用~但不能使用jquery符号,这是一个冲突! 但是在这种情况下,我如何调用这个函数呢

function uc_discountsOnLoad(e) {

  context = $('body');
  uc_discountsProcessCodes(context, e);

  //Add click event listener to discounts pane button once
  $("input[id*=uc-discounts-button]:not(.uc_discountsOnLoad-processed)", 
    context).addClass("uc_discountsOnLoad-processed").click(function(e) {
      uc_discountsProcessCodes(context, e);
      //Return false to prevent default actions and propogation
      return false;
    });
}

如果在(函数($){}(jQuery);,外部定义uc_折扣SONLOAD(e)$('body')将出错

找不到
uc\u折扣sonload(e)
功能

  • 检查
    uc_discounters.js
    以查看该函数是否实际存在

  • 调用函数后是否加载uc_discounters.js?(检查页面来源)


100%确定函数存在且已加载uc_.js~