开发者

form :remote => true, not working in IE?

- form_for(@post, :remote => true, :id => 'post_form') do |f|

Works as expected in FF and Chrome, but IE just processes the submit action normally, without any ajax request.

Not really seeing any info on this on the rest of the开发者_StackOverflow社区 internet so I imagine I've done something wrong somehow. Ive used both the default rails.js, and the jquery version from the github page


Well, I don't know why the default rails version doesn't work for me here on IE, but I wrote this as a workaround:

if ($.browser.msie) {
    var form = $('form#new_post');
    form.find('input#post_submit').bind('click', function(){
        var data = form.serializeArray();
        $.ajax({url: '/posts', type: 'POST', data: data});
        return false
    });
}

And now it's working correctly. Shouldn't something like this be included in rails.js if this is in fact a problem with Rails, and not something that I've somehow done?


In our Rails 3 app the form tagged as data-remote wasn't turned into an AJAX form any longer after we had upgraded to jquery-rails 1.0.19. IE7 wasn't able to load the jquery.js - there seems to be a problem with version 1.7.1 of jQuery currently. After downgrading to jquery-rails 1.0.18 the problem disappeared again.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜