1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

jquerymobileのform送信がデフォルトでajaxだったから止めた

Posted at

デフォルトでajax送信されると色々と不便で、さくっと作りたいから止めてみた。

ググると色んな人が停止していたが、方法としては2つあるらしい。

  1. javascriptで停止
  2. formにdata-ajax=falseを記入

まずは全体止めたいので1を試してみましたが出来ず!
なので「らしい」と言う表記にしました。

残りは2ですが、いちいちform_forに書くのもめんどくさいので、
config/initializersの下にform_helper.rbって名前でファイル作って
form_forをoverrideしました。

def form_for
  #-----省略
  html_options["data-ajax"] = :false
  #-----省略
end

こう書いておけば意識しなくてもdata-ajax=falseがついてくれるので
ajax送信されなくてすみます!

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?