# Is this possible

**URL:** <https://www.ruby-forum.com/t/is-this-possible/93032>\
**Category:** Rails\
**Created:** [April 26, 2007, 7:24pm UTC](https://www.ruby-forum.com/t/is-this-possible/93032 "2007-04-26T19:24:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![darushin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/67e7ee/32.png) [@darushin](https://www.ruby-forum.com/u/darushin)\
**Post date:** [April 26, 2007, 7:24pm UTC](https://www.ruby-forum.com/t/is-this-possible/93032/1 "2007-04-26T19:24:34Z")

</div>

Hello again

I have a scenario where I am going to have a div that periodically  
updates information from the server (think like a newsfeed or stock  
ticker). I am using AJax on the browser side to accomplish this now.  
However, I am wondering if it is possible for when the update request  
comes in to the server If it is determined that the content hasn’t  
changed to send back an “abort update” somehow to the browser that would  
cause the div to remain unchanged. I am fairly new to the Prototype  
classes in general so I am not even sure where to begin with this.

Ben

---

<div class="post-metadata">

**Author:** ![darushin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/67e7ee/32.png) [@darushin](https://www.ruby-forum.com/u/darushin)\
**Post date:** [April 26, 2007, 8:33pm UTC](https://www.ruby-forum.com/t/is-this-possible/93032/2 "2007-04-26T20:33:19Z")

</div>

Hi Ben,

Darushin wrote:

> I have a scenario where I am going to have a div that periodically  
> updates information from the server (think like a newsfeed or stock  
> ticker). I am using AJax on the browser side to accomplish this now.  
> However, I am wondering if it is possible for when the update request  
> comes in to the server If it is determined that the content hasn’t  
> changed to send back an “abort update” somehow to the browser that would  
> cause the div to remain unchanged. I am fairly new to the Prototype  
> classes in general so I am not even sure where to begin with this.

In your RJS template, or in the controller if that’s where you’re  
currently  
doing the render,

page.render :nothing =\> true

will accomplish what you’re looking for.

hth,  
Bill

---

<div class="post-metadata">

**Author:** ![darushin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/67e7ee/32.png) [@darushin](https://www.ruby-forum.com/u/darushin)\
**Post date:** [April 26, 2007, 8:40pm UTC](https://www.ruby-forum.com/t/is-this-possible/93032/3 "2007-04-26T20:40:20Z")

</div>

If you’re using an RJS template to return JavaScript to the browser  
couldn’t you just return an empty response so that your page doesn’t  
update.

What happens if you do something like this in your RJS template:

page.replace\_html(“cart”, :partial =\> “cart”, :object =\> @cart) if  
@cart.has\_changes?

Of course you would need to provide the has\_changes? method on your  
object.

I can’t guarantee this will work because I’ve not tested this. But,  
give it a shot and see what happens.
