Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
咖啡脚本中jQuery($)的用途是什么?_Jquery_Playframework_Coffeescript_Playframework 2.1 - Fatal编程技术网

咖啡脚本中jQuery($)的用途是什么?

咖啡脚本中jQuery($)的用途是什么?,jquery,playframework,coffeescript,playframework-2.1,Jquery,Playframework,Coffeescript,Playframework 2.1,我不熟悉jQuery和coffee脚本。在我的旅程中,我在咖啡剧本的开头几次碰到了以下结构: jQuery ($) -> $table = $('.container table') productListUrl = $table.data('list') ... 将其转换为以下javascript (function() { jQuery(function($) { var $table, productListUrl; $table = $('.co

我不熟悉jQuery和coffee脚本。在我的旅程中,我在咖啡剧本的开头几次碰到了以下结构:

jQuery ($) ->
  $table = $('.container table')
  productListUrl = $table.data('list')
  ...
将其转换为以下javascript

(function() {

  jQuery(function($) {
    var $table, productListUrl;
    $table = $('.container table');
    productListUrl = $table.data('list');
    return $.get(productListUrl, function(products) {
      return $.each(products, function(index, eanCode) {
        var row;
        row = $('<tr/>').append($('<td/>').text(eanCode));
        return $table.append(row);
      });
    });
  });

}).call(this);
有人能帮点忙吗?

正如您所说,jQueryfunction${…}是一种为DOM就绪事件声明回调的方法


回调函数的参数$确保此函数中的$符号是jQuery快捷方式,如

中所述。我确信这是重复的,但我现在很难找到它。不管怎样,读一读,你就会知道外部函数是用来做什么的。
$(function() {
...
});