DragonWar% 2014-04-13 19:39 采纳率: 0%
浏览 31

找不到Rails AJAX获取网址

When doubleClick an element, I'm trying to get a url, then pull the replace the html of #propertiesBox with the contents of that url.

$('.elemContainer').dblclick(function() {

    $.get("/ui/propertiesBox", function(data) {
        $("#propertiesBox").html(data);
        alert("Load was performed.");
    });

});

The url I want to get is views/ui/_propertiesBox.html.erb

  • 写回答

1条回答 默认 最新

  • weixin_33705053 2014-04-13 19:48
    关注

    You need a route for that url:

    #routes
    get 'ui/propertiesBox' => 'some_controller#properties_box'
    

    And appropriate action in controller:

    #controller 
    def properties_box
      render :partial => 'propertiesBox'
    end
    

    To make it happen.

    评论

报告相同问题?