Disable Ajax call with link_to rails

I am unable to disable jQuery for mobile Ajax call for link_to

.

I have a redirect link

 <%= 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 the transformation 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 have found that the setting data-ajax=false

would be sufficient to disable Ajax for this link, but it is not. another_method_path

called first, leaving me with my_post_path

.

If I disable Ajax completely

 $.mobile.ajaxEnabled = false;

      

It works as expected.

Am I doing something wrong in localization link_to

?

+3


source to share


1 answer


I think setting rel: :external

in the link should do the trick already.

see the Linking Without Ajax section here: http://jquerymobile.com/demos/1.1.1/docs/pages/page-links.html



I guess the problem is with your link :method => :post

, as this will only work with forms or ajax.

+1


source







All Articles