代码之家  ›  专栏  ›  技术社区  ›  JohnDel

链接到远程不起作用:使用jrails

  •  0
  • JohnDel  · 技术社区  · 15 年前

    我正在尝试使用link\u to\u remote with:with参数,这样我就可以传递我的参数了,但是我使用的是jrails,它似乎不起作用。我把它和jrails和prototype一起使用,效果很好。以下是我在jrails中不使用原型的代码:

    <%= link_to_remote render(:partial => "back_button_text"),
       {:url => { :controller=> "content", :action => "ajax_sec_cat_display", :with => "'location=' + $("#history").html()" },
       :loading => "addSpinner()",
       :complete => "removeSpinner()"},
       :class => "menu_item back"
    %>
    

    <%= link_to_remote( "Google Map Look Up", 
          :url =>{ :action => :google_map}, 
          :with => "'location=' + $('vcompany_locations_attributes_0_address_1').value") 
       %>
    
    1 回复  |  直到 15 年前
        1
  •  0
  •   JohnDel    15 年前

    我最终用了这样一个不引人注目的jquery:

    $(document).ready(function(){
    
    $(".back").live("click", function() {
        var history = $("#history").html();
        $.ajax({
            beforeSend: function(request){addSpinner();}, 
            complete: function(request){removeSpinner()}, 
            data: 'history=' + history, 
            dataType:'script', 
            type:'post', 
            url:'/content/ajax_back_history'
        });
    });
    return false;
    

    });

    参数[:历史] .