开发者

Ruby on Rails: link_to_remote javascript broken?

I have this

开发者_如何学Go<%= link_to_remote "Next", 
    {:url => { :controller=>:objects,
        :action=>:filter_recent,
        :page=>@objects.next_page},
        :with => "Form.serialize('filter')" }, 
    :after => "alert('hello')"%>

I've tried :before, :after, :loading, :complete... none of them appear to be working... I know the button works, cause the table advances to the next page.


It looks like your arguments are incorrectly split up by the hash you wrapped them in.

Your :after JS snippet/callback is being passed to the html_options argument hash, not the options hash (where it would be used).

Change to the following:

<%= link_to_remote "Next", 
    :url => { 
        :controller=>:objects,
        :action=>:filter_recent,
        :page=>@objects.next_page
    },
    :with => "Form.serialize('filter')",
    :after => "alert('hello')"%>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜