Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/68.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 UI对话框显示操作(Rails 3)_Jquery_Ruby On Rails 3_Jquery Ui Dialog - Fatal编程技术网

JQuery UI对话框显示操作(Rails 3)

JQuery UI对话框显示操作(Rails 3),jquery,ruby-on-rails-3,jquery-ui-dialog,Jquery,Ruby On Rails 3,Jquery Ui Dialog,在开始之前,我是javascript、rails 3和jQuery的初学者,所以请 提供完整的例子 以下是我想做的: 我已经用scaffold构建了一个rails应用程序,并将默认javascript更改为 jQuery以使仪表板上的piechart正常工作 所以现在我想我可以添加jqueryui并显示一个带有Show的对话框 当有人单击Show时创建的脚手架的操作 对话框的标题必须是id 不幸的是,到目前为止我所尝试的一切都没有奏效 我试过:,:remote=>true 我认为最大的问题是,至

在开始之前,我是javascript、rails 3和jQuery的初学者,所以请 提供完整的例子

以下是我想做的: 我已经用scaffold构建了一个rails应用程序,并将默认javascript更改为 jQuery以使仪表板上的piechart正常工作

所以现在我想我可以添加jqueryui并显示一个带有Show的对话框 当有人单击Show时创建的脚手架的操作

对话框的标题必须是id

不幸的是,到目前为止我所尝试的一切都没有奏效

我试过:,:remote=>true

我认为最大的问题是,至少有一个帖子被执行了 如果我查看终端中的错误,它会显示:

Started POST "/trips/1" for 127.0.0.1 at Sun Sep 19 11:07:24 +0200 2010
ActionController::RoutingError (No route matches "/trips/1"):
我认为应该执行GET

这是我的完整索引文件:

<h1>Listing trips</h1>

<table>
<tr>
<th>License</th>
<th>Contract</th>
<th>Time</th>
<th></th>
</tr>

<% @trips.each do |trip| %>
<tr>
<td><%= trip.license %></td>
<td><%= trip.contract %></td>
<td><%= trip.time %></td>
<td><%= link_to 'Show', trip, 'class'=>"ajax", :remote => true %></td>
<td><%= link_to 'Show', trip, 'class'=>"ajax" %></td>
<td><%= link_to 'Show', trip, 'id' => 'opener', :remote => true %></td>
<td><%= link_to 'Show', trip, 'id' => 'opener' %></td>
<td><%= link_to 'Show', trip, 'id' => 'showdialog', :remote => true %></td>
</tr>
<% end %>
</table>

<div id="example"></div>

<script type="text/javascript">
$(document).ready(function(){
var dialogOpts = {
  modal: true,
  bgiframe: true,
  autoOpen: false,
  height: 500,
  width: 500,
  draggable: true,
  resizeable: true,
};
$("#example").dialog(dialogOpts);   //end dialog

$('#showdialog').click(
  function() {
     $("#example").load(this.href, type: 'get', function(){
           $("#example").dialog("open");
        } 
     );
     return false;
  }
);

});
</script>

<script type="text/javascript">
$(document).ready(function() {
var dialogOpts = {
    autoOpen: false,
    title: 'Trip: Trip Number comes here',
    modal: true,
    height: 600,
    width: 600,
    draggable: false,
    resizable: false        
}

var $dialog = $('<div></div>')
    .html('Must become show action!')
    .dialog(dialogOpts);

    $('ae[data-remote=true]').live('click', function() {
      $dialog.dialog('open');
      return false;
    });

$('#opeaner').click(function() {
    $dialog.dialog('open');
    // prevent the default action, e.g., following a link
    return false;
});
});

    $(function (){
            $('aa.ajax').click(function() {
                    var url = this.href;
                    var dialog = $('<div></div>');
                    // load remote content
                    jQuery.ajax({type: 'GET'})
                    dialog.load(
                            url, 
                            {},
                            function (responseText, textStatus, XMLHttpRequest) {
                                    dialog.dialog();
                            }
                    );
                    //prevent the browser to follow the link
                    return false;
            });
    });

    var request = function(options) {
      $.ajax($.extend({ url : options.url, type : 'get' }, options));
      return false;
    };

    // remote links handler
    $('a[data-remote=true]').live('click', function() {
      return request({ url : this.href });
    });

</script>
我知道现在是一团糟, 但那是因为我已经尝试了很多东西,所以我改变了一些标签 让新事物发挥作用

到目前为止唯一有效但没有给我表演的东西,只是一个普通的 带有一些选项的对话框是:opeaner one


非常感谢你!非常感谢

在本例中,请尝试在link:get中指定方法,以达到显示操作:

<%= link_to 'Show', trip, 'id' => 'showdialog', :remote => true, :method => :get %>

非常感谢。不幸的是,它没有工作,它炸毁了内存使用或ruby,我不得不被迫退出,虽然很奇怪。。