0
我想用另一个javascript函数调用来扩展button_to_remote的onclick参数,但是我找不到任何答案。 所以我有SG是这样的:在rails中扩展button_to_remote的onclick参数
button_to_remote('>', :url => {:action => "show_dtree", :id => tree_child.id, :dir1 => dir11, :dir2 => dir12}
什么生成以下代码:
<input onclick="new Ajax.Request('/d_trees/show_dtree/3?dir1=1&dir2=2', {asynchronous:true, evalScripts:true, parameters:'authenticity_token=' + encodeURIComponent('2e8e2147c344bcee0edf40f8fe6072c12dc928d7')});" type="button" value=">" />
我的目的,是要调用一个Foo()函数后,Ajax请求对象实例化:
<input onclick="new Ajax.Request('/d_trees/show_dtree/3?dir1=1&dir2=2', {asynchronous:true, evalScripts:true, parameters:'authenticity_token=' + encodeURIComponent('2e8e2147c344bcee0edf40f8fe6072c12dc928d7')});foo();" type="button" value=">" />
有没有什么办法可以让我自己生成整个按钮?
感谢您的帮助!
感谢您的快速回复! – seriakillaz 2010-10-21 20:41:54