Faiz Abbasi
Faiz Abbasi

Reputation: 35

How do I hit a link without rendering the page?

I was wondering if it is possible to hit an external link without rendering that page, instead staying on the page or re-rendering the current screen. Essentially the link I'd like to hit provides me an action, but I do not want the user to view that page.

Upvotes: 0

Views: 182

Answers (2)

Ismael
Ismael

Reputation: 16730

using :remote => true should work and you can respond with js to show some message saying the action has been done successfully.

http://apidock.com/rails/ActionView/Helpers/UrlHelper/link_to

Upvotes: 1

Dave Newton
Dave Newton

Reputation: 160261

Make it an Ajax call (remote: true) and ignore the result.

Upvotes: 2

Related Questions