0

Javascriptを介して「制御」されるいくつかのボタンが横にあるフォームがあります。

たとえば、私が関係しているものはこれを行います:

    $('.edit_document').submit();

ここまでは順調ですね。このフォームで問題を抱えていた Windows の Chrome ユーザーから、いくつかのバグ レポートを受け取りました。Rails はそれを HTML ではなく JS として受け取っていたことがわかりました。

Started PUT "/documents/1236" for xxxxxxxxxx at 2012-10-18 08:45:41 +0000
Processing by DocumentsController#update as HTML

Started PUT "/documents/1229" for yyyyyyyyyy at 2012-10-18 08:46:08 +0000
Processing by DocumentsController#update as JS

Started PUT "/documents/1229" for yyyyyyyyyy at 2012-10-18 09:06:25 +0000
Processing by DocumentsController#update as JS

Started PUT "/documents/18" for xxxxxxxxx at 2012-10-18 09:27:15 +0000
Processing by DocumentsController#update as HTML

さて、.js ハンドラーを追加するのは簡単だと思いますが、2 つのハンドラーをランダムに切り替えているように見える理由をもっとよく理解したいと思います!

使用: jquery 1.8.2、Rails 3.2.8、Ubuntu (HTML として動作) および Windows (JS として動作) 上の Chrome バージョン 22.0.1229.94。

4

0 に答える 0