我換成原型用jQuery爲Rails 3 我現在想做到以下幾點:的Rails 3 JQuery的page.insert_html和類型錯誤:Element.insert不是一個函數
#photo
=render 'shared/photo'
= link_to_function "Add a Photo" do |page| |
page.insert_html :bottom, 'photo', :partial => 'shared/photo', :object => Photo.new |
end |
所以JavaScript的產生是:
try {
Element.insert("photo", {
bottom: "Data\n\n"
});
} catch (e) {
alert('RJS error:\n\n' + e.toString());
alert('Element.insert(\"photo\", { bottom: \"Data\\n\\n\" });');
throw e
};
return false;
在軌文檔insert_html是一個原型幫手,但我認爲與https://github.com/rails/jquery-ujs更換Rails.js將取代這個助手jQuery的幫手。我得到一個TypeError.ElementInsert不是一個函數。
我做錯了什麼?或者我是否會在沒有幫手的情況下自己做這件事?