我有两个名为client/orders
and的控制器notary/orders
。在“客户/订单”中有 click_me 链接。当我单击链接时,我应该将 ajax 请求传递到notary/orders/pending_orders
页面reload the notary/orders/pending_orders
。
这是我在 client/orders/new 中的 Ajax 调用
<script>
jQuery.noConflict();
jQuery(document).ready(function(){
alert(9);
jQuery(".test_link").live("click", function(){
alert("am clicked");
jQuery.ajax({
url: "/notary/orders/pending_orders",
dataType: 'script',
type: "get",
data: {data:'hi'},
success:function(){
alert("success");
},
error:function(){
alert("failure");
}
});
})
});
<%= link_to "click me", "javascript:void(0);" , :class => "test_link" %>
这是我的代码notary/orders/pending_orders
if request.xhr?
respond_to do |format|
format.js { render :js=>'location.reload();',
:location => "notary/orders/pending_orders"}
end
end
但它client/orders/new
不会重新加载notary/orders/pending_orders
。但我想重新加载公证/订单/pending_orders。我该怎么做?