I am listening to a button
and some a
tags with this code:
$("#pagination_partial a, #order_sorting_partial a, #order_sorting_partial .organize-btn").bind("click", function() {
$.getScript(this.href);
history.pushState(null, "", this.href);
return false;
});
The code is supposed to get the href from the clicked element, but as of now it is only getting the href from the a
tags. When I click the organize-btn
the code understands that the button is clicked, but it does not assign anything to @href
.
What am I doing wrong? Here is the view file (HAML):
.row
.span
.btn-group
%button.btn{:href => "/orders?view=#{@organize_mode}", :class => "organize-btn"}= t(".#{@organize_mode}")
%button.btn.dropdown-toggle{"data-toggle" => "dropdown"}
%span.caret
%ul.dropdown-menu
%li
%a{:href => "/orders?view=by_last_dispatch"}= t(".by_last_dispatch")
%li
%a{:href => "/orders?view=by_first_dispatch"}= t(".by_first_dispatch")