0

私はdrupalモジュールをデバッグしています、2行目のdrupal_add_jsはuc_discounts.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_discountsOnLoadが定義されていません。誰でも問題を理解できますか?

** アップデート **

私は問題を知っていました!

外部で定義されている場合はuc_discountsOnLoad(function($){})(jQuery); 呼び出すことはできますが、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;
    });
}

(function($){})(jQuery);の外でuc_discountsOnLoad(e)を定義すると、$('body')はエラーになります!

4

1 に答える 1

0

uc_discountsOnLoad(e)関数が見つかりません。

  • uc_discounts.js関数が実際に存在するかどうかを確認します。

  • uc_discounts.js関数が呼び出された後にロードされますか? (ページのソースを確認してください)

于 2013-03-11T14:39:49.317 に答える