我想对我的路由使用相同的 AJAX 调用。我如何设置网址?
路线:
put :sort, :path => 'activities/sort', :controller => 'activities'
put :sort, :path => 'articles/sort', :controller => 'articles'
JS:
$.ajax({
type: "PUT",
url: 'activities/sort', # I wanna change this line
data: {ids:newOrder},
dataType: "html",
error: function()
{
alert('Positions has not been saved.');
$('#sortable').sortable('cancel');
}
});
我在想这样的事情:
url: <%= action: 'sort' %>
但它重定向到 'localhost:3000/sort' 但我想要 'localhost:300/current_controller/sort'