Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/66.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.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
弹出模式中的Javascript未运行_Javascript_Ruby On Rails_Ruby_Ruby On Rails 3 - Fatal编程技术网

弹出模式中的Javascript未运行

弹出模式中的Javascript未运行,javascript,ruby-on-rails,ruby,ruby-on-rails-3,Javascript,Ruby On Rails,Ruby,Ruby On Rails 3,如何让下面的代码在JavaScript弹出模式框的加载中运行?我用的是facebox $(函数(){ 函数初始化事件(){ /*新类别*/ $(“#新的管理类别”)。关于('ajax:success',函数(事件、数据、状态、xhr){ $(“#dashboard_categories”).html(data.html); 初始化事件(); }); /*删除类别*/ $('a[data remote]')。on('ajax:success',函数(事件、数据、状态、xhr){ $(“#dash

如何让下面的代码在JavaScript弹出模式框的加载中运行?我用的是facebox


$(函数(){
函数初始化事件(){
/*新类别*/
$(“#新的管理类别”)。关于('ajax:success',函数(事件、数据、状态、xhr){
$(“#dashboard_categories”).html(data.html);
初始化事件();
});
/*删除类别*/
$('a[data remote]')。on('ajax:success',函数(事件、数据、状态、xhr){
$(“#dashboard_categories”).html(data.html);
初始化事件();
});
}
初始化事件();
})();

如果您需要了解我的代码正在执行的操作,请参阅前面的问题:

已解决!其实很简单。。。我把它从头上取下来放在身体里

  <script type='text/javascript'>

    $(function () {
        function InitializeEvents() {
            /* new category */
            $('#new_admin_category').on('ajax:success', function (event, data, status, xhr) {
                $("#dashboard_categories").html(data.html);
                InitializeEvents();
            });

            /* delete category */
            $('a[data-remote]').on('ajax:success', function (event, data, status, xhr) {
                $("#dashboard_categories").html(data.html);
                InitializeEvents();
            });
        }
        InitializeEvents();
    })();

  </script>

$(函数(){
函数初始化事件(){
/*新类别*/
$(“#新的管理类别”)。关于('ajax:success',函数(事件、数据、状态、xhr){
$(“#dashboard_categories”).html(data.html);
初始化事件();
});
/*删除类别*/
$('a[data remote]')。on('ajax:success',函数(事件、数据、状态、xhr){
$(“#dashboard_categories”).html(data.html);
初始化事件();
});
}
初始化事件();
})();
  <script type='text/javascript'>

    $(function () {
        function InitializeEvents() {
            /* new category */
            $('#new_admin_category').on('ajax:success', function (event, data, status, xhr) {
                $("#dashboard_categories").html(data.html);
                InitializeEvents();
            });

            /* delete category */
            $('a[data-remote]').on('ajax:success', function (event, data, status, xhr) {
                $("#dashboard_categories").html(data.html);
                InitializeEvents();
            });
        }
        InitializeEvents();
    })();

  </script>