I want to pass params from one view to another. In my index.html.erb I have an empty div:

**index.html.erb:**

```
<div id="main"> </div>

```

First I am loading the main.html.erb file within a side bar by the following link:

**side.html.erb**

```
<%= link_to image_tag('btn_next.png'), home_main_path(:game_id=>item.game.id), :remote => true %>

```

This is loading my main.html.erb file into the main-div. Here is some code:

**main.js.erb**

```
$("#main").html("<%= escape_javascript render(:file => 'home/main.html.erb', :handlers => [:erb]) %>");

```

**home\_controller.rb**

```
def main
    puts 'main called'
    ...

```

**logs**

```
main called

Started GET "/home/main?game_id=1" for 127.0.0.1 at 2016-02-15 18:54:37 +0100
Processing by HomeController#main as JS
  Parameters: {"game_id"=>"1"}

```

Everything works fine. Now, inside the the main.html.erb I have a link to a game\_main.html.erb file:

**main.html.erb**

```
<%= link_to I18n.t('basic.game_statistic'), home_game_main_path(:game_id => @game.id, :mode => 'GameGoals'), :remote => true, :class => "main" %>

```

Here some code for the game\_main link:

**game\_main.js.erb**

```
$("#main").html("<%= escape_javascript render(:file => 'home/game_main.html.erb', :handlers => [:erb]) %>");

```

**home\_controller.rb**

```
def game_main
    puts 'game_main called'
    ...

```

The html file gets loaded inside the main-div. But the game\_main-controller is not called. My logs:

**logs**

```
Started GET "/home/game_main?game_id=1&mode=GameGoals" for 127.0.0.1 at 2016-02-15 19:13:19 +0100
Processing by HomeController#game_main as JS
  Parameters: {"game_id"=>"1", "mode"=>"GameGoals"}

```

without a notice 'game\_main called'. So I am not able to get the params. What went wrong? I am able to process the HomeController#main but not HomeController#game\_main.

Thanks for help.

Lars

P.S.: My routes:

**routes.rb**

```
match '/home/main', :to => 'home#main' 
match '/home/game_main', :to => 'home#game_main' 

```

**rake routes**

```
home_main        /home/main(.:format)                  home#main
home_game_main   /home/game_main(.:format)             home#game_main

```