Kir
Kir

Reputation: 8111

handle link_to external parameters

I have a link that have external data-offset parameter:

<%= link_to "Load more", something_path, :remote => true, :"data-offset" => 30 %>

Is it possible to get and handle data-offset in controller in ajax action? If no, is there any similar solution?

Upvotes: 0

Views: 137

Answers (1)

tadman
tadman

Reputation: 211580

You should end up with a data-offset parameter in the HTML you can access with JavaScript. In jQuery you might do this:

var data_offset = $('a[data-offset]').attr('data-offset');

Upvotes: 1

Related Questions