Rendering view using ajax is not working

hi all,

      im calling a method in my controller from my view

(category.rhtml) using form_remote_tag.the method was called properly
but the view its rendering was not replaced properly in the parent view
(category.rhtml).

                  in my parent view (category.rhtml) im having a div

with id called “block” where i want the rendered partial to be
replaced.when i tried to execute im getting the output as

try {
Element.update(“block”, "\n\n calling controller
method

\n\n\n\n\n this is to check\n\n\n\n");

} catch (e) { alert(‘RJS error:\n\n’ + e.toString());

alert('Element.update(“block”, "\n\n calling
controller

method \n\n\n\n\n this is to

check\n\n\n\n");’); throw e }

people know it please help me.

maybe you are using the :updae option in your form_remote_tag
in this case it would expect simple html as response.

you’re using something like insert_html instead, which creates the js
code for inserting.

if you use :update, you controller should simply use something like:
render :partial => “my_partial”
and this partial should contain html

if your controller uses insert_html (or other methods of that kind) then
you should not use the :update option.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs