I have inside a fancybox box is already opened the next link:
<%= link_to new_user_board_path(current_user), :method => :get, :remote => true, :url => { :controller => "users/boards", :action => "new" } do%>
When I doing click in this link call to file new.js.erb
I want close current fancybox box and open other new fancybox from new.js.erb file. I want add a partial inside new fancybox box:
I have in new.js.erb
$.fancybox.close();
and now how open the new fancybox?
I have tried:
$.fancybox()
but I get:
The requested content cannot be loaded.
Please try again later.
and I want add this code to the new fancybox:
<h1>New board</h1>
<%= render 'formnew' %>
<%= link_to 'Back', user_boards_path %>
I would say that you don’t actually need to close the current fancybox and open a new one “step-by-step” (using
$.fancybox.close), it would enough just to bind the link inside the current modal to a fancybox call, for instanceif the first fancybox was opened with this script:
then bind fancybox to the link inside the current fancybox assigning it the same class as the selector of the js call like:
That will call the new content in (a new) fancybox and will close the current at the same time.