# Rendering view using ajax is not working

**URL:** <https://www.ruby-forum.com/t/rendering-view-using-ajax-is-not-working/136919>\
**Category:** Rails\
**Created:** [May 7, 2008, 12:10pm UTC](https://www.ruby-forum.com/t/rendering-view-using-ajax-is-not-working/136919 "2008-05-07T12:10:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![karthikragu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a88e57/32.png) [@karthikragu](https://www.ruby-forum.com/u/karthikragu)\
**Post date:** [May 7, 2008, 12:10pm UTC](https://www.ruby-forum.com/t/rendering-view-using-ajax-is-not-working/136919/1 "2008-05-07T12:10:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![karthikragu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a88e57/32.png) [@karthikragu](https://www.ruby-forum.com/u/karthikragu)\
**Post date:** [May 7, 2008, 12:57pm UTC](https://www.ruby-forum.com/t/rendering-view-using-ajax-is-not-working/136919/2 "2008-05-07T12:57:34Z")

</div>

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.
