# Ajax response strip script tag from response

**URL:** <https://www.ruby-forum.com/t/ajax-response-strip-script-tag-from-response/161288>\
**Category:** Rails\
**Created:** [February 25, 2009, 2:26am UTC](https://www.ruby-forum.com/t/ajax-response-strip-script-tag-from-response/161288 "2009-02-25T02:26:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rgagnon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e95f7d/32.png) [@rgagnon](https://www.ruby-forum.com/u/rgagnon)\
**Post date:** [February 25, 2009, 2:26am UTC](https://www.ruby-forum.com/t/ajax-response-strip-script-tag-from-response/161288/1 "2009-02-25T02:26:27Z")

</div>

An newbie question. I have a “script” tag included in the response of  
an ajax call (from a link\_to\_remote) But this script tag is in the  
response(seen in firebug) but not on the webpage. It is stripped by  
something.

I try to use the jquery auto complete plugin but I’m having hard time to  
set this up.

any helps will be appreciated.

RÃ©mi

---

<div class="post-metadata">

**Author:** ![rgagnon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e95f7d/32.png) [@rgagnon](https://www.ruby-forum.com/u/rgagnon)\
**Post date:** [February 25, 2009, 9:06am UTC](https://www.ruby-forum.com/t/ajax-response-strip-script-tag-from-response/161288/2 "2009-02-25T09:06:44Z")

</div>

On Feb 25, 1:26 am, Rémi Gagnon [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> An newbie question. I have a “script” tag included in the response of  
> an ajax call (from a link\_to\_remote) But this script tag is in the  
> response(seen in firebug) but not on the webpage. It is stripped by  
> something.

I don;t know jquery, but prototype by default strips script tags from  
responses. You might want to poke around the jquery api and see if  
they do anything similar.

Fred

---

<div class="post-metadata">

**Author:** ![rgagnon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e95f7d/32.png) [@rgagnon](https://www.ruby-forum.com/u/rgagnon)\
**Post date:** [February 25, 2009, 12:20pm UTC](https://www.ruby-forum.com/t/ajax-response-strip-script-tag-from-response/161288/3 "2009-02-25T12:20:26Z")

</div>

Thank you Frederick,

That means I can’t have an other ajax call within an ajax response. Its  
odd. In my case I have ‘tabs’ and the action of these tabs are in ajax,  
within these tabs I have an auto complete field. How can I make this  
work?

Thank you

RÃ©mi

Frederick C. wrote:

> I don;t know jquery, but prototype by default strips script tags from  
> responses. You might want to poke around the jquery api and see if  
> they do anything similar.
> 
> Fred

---

<div class="post-metadata">

**Author:** ![rgagnon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e95f7d/32.png) [@rgagnon](https://www.ruby-forum.com/u/rgagnon)\
**Post date:** [February 25, 2009, 12:40pm UTC](https://www.ruby-forum.com/t/ajax-response-strip-script-tag-from-response/161288/4 "2009-02-25T12:40:57Z")

</div>

On 25 Feb 2009, at 11:20, Rémi Gagnon wrote:

> Thank you Frederick,
> 
> That means I can’t have an other ajax call within an ajax response.  
> With prototype it’s just the default. You don’t have to have it that  
> way (don’t know about jQuery)

> Its  
> odd. In my case I have ‘tabs’ and the action of these tabs are in  
> ajax,  
> within these tabs I have an auto complete field. How can I make this  
> work?

Well a lot of folks shy away from script tags altogether these days,  
and just attach event handlers to stuff (eg from the callbacks of the  
thing that caused the partial to be inserted that way). I got the  
impression jQuery in particular leant quite heavily that way.

Fred
