# Render\_to\_string problem

**URL:** <https://www.ruby-forum.com/t/render-to-string-problem/187852>\
**Category:** Rails\
**Created:** [April 30, 2010, 1:46pm UTC](https://www.ruby-forum.com/t/render-to-string-problem/187852 "2010-04-30T13:46:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhishek\_shukla](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7cd45c/32.png) [@Abhishek\_shukla](https://www.ruby-forum.com/u/Abhishek_shukla)\
**Post date:** [April 30, 2010, 1:46pm UTC](https://www.ruby-forum.com/t/render-to-string-problem/187852/1 "2010-04-30T13:46:34Z")

</div>

i have a scenario where a jquery is receiving a response in the string  
and  
which content html component like “\<div id=“test”\>test” ideally  
in a  
view it should display only “test” but it displaying entire string test is there any way i am deal with the problem through  
js  
or rails?

Thanks  
abhis

---

<div class="post-metadata">

**Author:** ![Abhishek\_shukla](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7cd45c/32.png) [@Abhishek\_shukla](https://www.ruby-forum.com/u/Abhishek_shukla)\
**Post date:** [May 4, 2010, 1:01am UTC](https://www.ruby-forum.com/t/render-to-string-problem/187852/2 "2010-05-04T01:01:23Z")

</div>

Are you escaping the javascript returned?(by calling the  
escape\_javascript helper?)

Abhishek shukla wrote:

> i have a scenario where a jquery is receiving a response in the string  
> and  
> which content html component like “\<div id=“test”\>test” ideally  
> in a  
> view it should display only “test” but it displaying entire string test is there any way i am deal with the problem through  
> js  
> or rails?
> 
> Thanks  
> abhis
