My problem is so weird:
I have this form:
<form id="my-form" method="post" action="/password_reset/update/<%= @user.perishable_token %>" charset="utf-8" autocomplete="off"> <input type="password" name="user[password]" class="required" minlength="6" /> <input type="password" name="user[password_confirmation]" class="required" equalto="#password-field" minlength="6" /> <input type="hidden" name="page" value="set" /> <input type="submit" value="Submit"/> </form>
The client send an ajax request to my rails server (using jquery 1.6.1, jQuery Validation Plugin 1.8.1, jQuery Form Plugin 2.67)
$("#my-form").validate({ submitHandler: function(form) { $(form).ajaxSubmit(); } });
The server side receives the request and here is the probleme. Sometimes:
Instead of get parameters with the expected format as below
Parameters: {"user"=>{"password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "page"=>"set", "id"=>"开发者_如何学运维bFC7bkz6tzOF4i2KXZ"}
... I get:
Parameters: {"_json"=>"user%5Bpassword%5D=password&user%5Bpassword_confirmation%5D=password&page=set", "id"=>"perishable_token"}
I tested the form in lots of cases (with different browsers/OS) and it's impossible to me to reproduce this problem. I can just see it in my production rails log.
So my questions are:
- Why this problem can happen ?
- How can I reproduce this bug ?
Thank you very much for your help.
Try set datatype, that you want:
$(form).ajaxSubmit({dataType=>"desirable format"});
format may be "xml", "script" or "json"
精彩评论