我有以下
games_controller
def sheet
@game=params[:id]
@champ=params[:ch]
@w_team=params[:wt]
@b_team=params[:bt]
@champ_id=params[:chi]
@w_team_id=params[:wti]
@b_team_id=params[:bti]
render template: "games/sheet.html.erb"
端
scripts.js中
function to_sheet(id){
tokentag = $('#tokentag').val();
var champ = $("#champ option:selected").text();
var w_team = $("#team_W option:selected").text();
var b_team = $("#team_B option:selected").text();
var champ_id = $("#champ option:selected").val();
var w_team_id = $("#team_W option:selected").val();
var b_team_id = $("#team_B option:selected").val();
$.ajax({
url: "/games/sheet",
type: "POST",
data: {"authenticity_token": tokentag,game_id:id, w_team:w_team, w_team_id:w_team_id, b_team:b_team, b_team_id:b_team_id, champ:champ, champ_id:champ_id},
success: function(response){
alert('hola');
}
});
}
的routes.rb
resources :games
post 'games/sheet' => 'games#sheet'
我的问题是game / sheet.html.erb没有显示在网页中(没有重定向到它)...它只在debuging部分的“预览”中呈现。你明白了吗?
我试过重定向redirect_to:controller =>'games',:action =>'sheet'但它没有用
谢谢!