I am using RoR’s link_to. I want both to send a :remote => true link_to which will preform an action on the page without a refresh AND I’d like to open a new page (:target=>”_blank”) in a new browser window.
How can I do both actions in one click?
Thanks!
Suppose you have a link:
If you wanted to open the new page after the action is performed, then you can put it in your action’s
myaction.js.erbfile:However, if you want the new window to open immediately when you click the link, you could add this javascript to intercept the remote call before it’s sent to the server (assuming you’re using jQuery):