# rendering view using ajax is not working

**URL:** <https://discuss.rubyonrails.org/t/rendering-view-using-ajax-is-not-working/29058>\
**Category:** rubyonrails-talk\
**Created:** [May 7, 2008, 10:10am UTC](https://discuss.rubyonrails.org/t/rendering-view-using-ajax-is-not-working/29058 "2008-05-07T10:10:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [May 7, 2008, 10:10am UTC](https://discuss.rubyonrails.org/t/rendering-view-using-ajax-is-not-working/29058/1 "2008-05-07T10:10:55Z")

</div>

hi all,

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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).

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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", "\<html\>\n\<head\>\n\<title\> calling controller method

\</title\>\n\</head\>\n\<body\>\n\n\n this is to check\n\n\</body\>\n\</html\>\n");

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

alert('Element.update(\"block\", \"\<html\>\\n\<head\>\\n\<title\> calling controller

method \</title\>\\n\</head\>\\n\<body\>\\n\\n\\n this is to

check\\n\\n\</body\>\\n\</html\>\\n\");'); throw e }

people know it please help me.

---

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [May 7, 2008, 10:57am UTC](https://discuss.rubyonrails.org/t/rendering-view-using-ajax-is-not-working/29058/2 "2008-05-07T10: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.
