在我的控制器中我試圖呈現香草JavaScript,但得到了意想不到的結果。這是代碼在Ruby中渲染香草JavaScript的問題
class UploadController < ApplicationController
def index
render :file => 'app\views\upload\uploadfile.rhtml'
end
def uploadFile
render :js => "alert('Hello Rails');"
post = DataFile.save(params[:upload])
end
end
上午在執行之前預計後期= DataFile.save(PARAMS [:上傳]),我應該去看alertbox但我看到了下載框。可能是什麼問題呢?
你確定你到達正確的路線嗎?你得到了什麼樣的錯誤? – 2010-10-20 12:09:38
我沒有收到任何錯誤,但是當我試圖渲染渲染時:js =>「alert('Hello Rails');」 從我的探險 – 2010-10-20 12:16:51