Hi there,
if got some problems getting the Ajax.Request to work with rails.
sending the request via onclick works but the interpretaition fails
if I execute:
render :update do |page|
page.replace ''test'', :text => ''it works''
end
I get 2 alerts:
RJS error:
TypeError: $("#test") is null
$("#test").replaceWith("it works");
---
There is a div with id="test" given.
To know more about it I changed the div''s id to "#test".
all I get is:
RJS error:
TypeError: $("#test").replaceWith is not a function
$("#test").replaceWith("it works");
I did <%= javascript_include_tag :default %> in the application, but
i''m
not quite sure if prototype is really implemented. How can I check this?
Prototype v.2.0.0
Rails v.2.3.5
Thank you
Hans
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
On Oct 12, 11:36 am, Hans Hartmann <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> TypeError: $("#test").replaceWith is not a function > > $("#test").replaceWith("it works"); > > I did <%= javascript_include_tag :default %> in the application, but i''m > not quite sure if prototype is really implemented. How can I check this? >WIth prototype if an element''s id is test then you''d want $(''test'') to get that element (if you want css selectors with prototype use $$)> Prototype v.2.0.0Unlikely - the latest version of prototype is the 1.7 release candidate Fred> Rails v.2.3.5 > > Thank you > Hans > > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
page.replace seems to be a helper which automatically searchs for
$(''#test'')
...
in other rails-projects it always worked liked that.
the v.2.0.0 I got by listing my gems via command line.
Isn''t there a possibility to get the "page.replace" to work?
if i do
page.document.getElementById(''test'')
everything is fine
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
How can I get the "page.replace" to work? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
new infos:
If i try the page.insert_html in my errored application, i get for
page.insert_html, :bottom, "test", :text => "it works."
try {
$("#test").append("it works.");
} catch (e) { alert(''RJS error:\n\n'' + e.toString());
alert(''$(\"#test555\").append(\"it
works.\");''); throw e }
In an application where all works fine, page.insert_html, :bottom,
"test", :text => "it works." is interpreted as:
Element.insert("test", { bottom: ... ...
Why is it not interpreted in my first application this way?
Thank you very much.
Hans
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.