# How to delete periodically\_call\_remote from the DOM

**URL:** <https://www.ruby-forum.com/t/how-to-delete-periodically-call-remote-from-the-dom/107632>\
**Category:** Rails\
**Created:** [June 24, 2007, 1:51pm UTC](https://www.ruby-forum.com/t/how-to-delete-periodically-call-remote-from-the-dom/107632 "2007-06-24T13:51:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e480ec/32.png) [@mikel](https://www.ruby-forum.com/u/mikel)\
**Post date:** [June 24, 2007, 1:51pm UTC](https://www.ruby-forum.com/t/how-to-delete-periodically-call-remote-from-the-dom/107632/1 "2007-06-24T13:51:51Z")

</div>

I have set up a periodically call remote on a page. To get it to stop  
calling I have made it reliant on a hidden element being populated  
with some value, this is all working.

But I want to actually delete the script from the DOM based on a  
decision from the server.

What would be the best way to go about doing this?

Thanks

Regards

Mikel

---

<div class="post-metadata">

**Author:** ![mikel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e480ec/32.png) [@mikel](https://www.ruby-forum.com/u/mikel)\
**Post date:** [June 24, 2007, 5:18pm UTC](https://www.ruby-forum.com/t/how-to-delete-periodically-call-remote-from-the-dom/107632/2 "2007-06-24T17:18:17Z")

</div>

that should be possible with rjs, shouldnt it?  
like that in the controller:  
page[‘updater’].replace ‘’

\<%= rails updater helper %\>

---

<div class="post-metadata">

**Author:** ![mikel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e480ec/32.png) [@mikel](https://www.ruby-forum.com/u/mikel)\
**Post date:** [June 24, 2007, 5:40pm UTC](https://www.ruby-forum.com/t/how-to-delete-periodically-call-remote-from-the-dom/107632/3 "2007-06-24T17:40:20Z")

</div>

Hi Mikel,

Mikel wrote:

> I have set up a periodically call remote on a page. To get it to stop  
> calling I have made it reliant on a hidden element being populated  
> with some value, this is all working.
> 
> But I want to actually delete the script from the DOM based on a  
> decision from the server.
> 
> What would be the best way to go about doing this?

One way to handle it would be to wrap the periodically\_call\_remote with  
a

\<div id="unique\_id\> and use RJS. Either page.replace or page.replace\_html depending on whether you wanted to get rid of the div entirely or just some of what's inside. \<p\>hth,\<br\> Bill\</p\>

---

<div class="post-metadata">

**Author:** ![mikel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e480ec/32.png) [@mikel](https://www.ruby-forum.com/u/mikel)\
**Post date:** [June 27, 2007, 6:32am UTC](https://www.ruby-forum.com/t/how-to-delete-periodically-call-remote-from-the-dom/107632/4 "2007-06-27T06:32:14Z")

</div>

> One way to handle it would be to wrap the periodically\_call\_remote with a
> 
> http://www.oreilly.com/catalog/9780596510657/  
> “Test Driven Ajax (on Rails)”  
> assert\_xpath, assert\_javascript, & assert\_ajax

---

<div class="post-metadata">

**Author:** ![mikel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e480ec/32.png) [@mikel](https://www.ruby-forum.com/u/mikel)\
**Post date:** [July 1, 2007, 4:54am UTC](https://www.ruby-forum.com/t/how-to-delete-periodically-call-remote-from-the-dom/107632/5 "2007-07-01T04:54:41Z")

</div>

Mikel wrote:

> I have set up a periodically call remote on a page. To get it to stop  
> calling I have made it reliant on a hidden element being populated  
> with some value, this is all working.
> 
> But I want to actually delete the script from the DOM based on a  
> decision from the server.
> 
> What would be the best way to go about doing this?

I answered this a couple days ago. Use Google G. and look for  
periodically\_call\_remote and my street name.

–  
Phlip  
[Test Driven Ajax (on Rails) [Book]](http://www.oreilly.com/catalog/9780596510657/)  
“Test Driven Ajax (on Rails)”  
assert\_xpath, assert\_javascript, & assert\_ajax

---

<div class="post-metadata">

**Author:** ![mikel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e480ec/32.png) [@mikel](https://www.ruby-forum.com/u/mikel)\
**Post date:** [July 1, 2007, 9:55am UTC](https://www.ruby-forum.com/t/how-to-delete-periodically-call-remote-from-the-dom/107632/6 "2007-07-01T09:55:55Z")

</div>

Thanks,

Regards

Mikel
