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