I cannot disable JQuery mobile Ajax call for a link_to.
I have a link with a redirect
<%= link_to 'test', my_post_path, :method => :post, "data-role" => "button", "rel" => "external", "data-ajax"=>"false", "data-inline" => "true", "data-icon" => "plus", "data-iconpos" => "left" %>
This is traslated in the following html
<a href="/my_post" data-ajax="false" data-icon="plus" data-iconpos="left" data-inline="true" data-method="post" data-role="button" rel="external nofollow">test</a>
my_post is just a redirect to
def my_post
redirect_to another_method_path(....)
end
I tought that setting data-ajax=false would have been sufficient to disable Ajax for this link, but it is not. another_method_path is called first, leaving me with my_post_path.
If I disable Ajax totally
$.mobile.ajaxEnabled = false;
It is working as expected.
Am I doing something wrong in the localise link_to?
i think that setting rel: :external on the link should do the trick already.
see the section "Linking without Ajax" here: http://jquerymobile.com/demos/1.1.1/docs/pages/page-links.html
i guess that the problem is :method => :post in your link, as this will only work with forms or ajax.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With