# Partials versus Ajax

**URL:** <https://www.ruby-forum.com/t/partials-versus-ajax/127950>\
**Category:** Rails\
**Created:** [February 3, 2008, 2:26am UTC](https://www.ruby-forum.com/t/partials-versus-ajax/127950 "2008-02-03T02:26:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mojave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@Mojave](https://www.ruby-forum.com/u/Mojave)\
**Post date:** [February 3, 2008, 2:26am UTC](https://www.ruby-forum.com/t/partials-versus-ajax/127950/1 "2008-02-03T02:26:47Z")

</div>

I have a section of a page that needs to update based on certain  
events. I use Ajax to do that updating. But on first loading the page,  
that section needs to be populated. I’ve read the way to do this is  
with partials. With partials, you can use the same method to create  
the initial content and to do the Ajax update. Another way is to  
simply make an Ajax call when the page first loads.

My question is which of these methods is better or is it a personal  
preference?

---

<div class="post-metadata">

**Author:** ![Mojave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@Mojave](https://www.ruby-forum.com/u/Mojave)\
**Post date:** [February 3, 2008, 2:41pm UTC](https://www.ruby-forum.com/t/partials-versus-ajax/127950/2 "2008-02-03T14:41:49Z")

</div>

Mojave wrote:

> I have a section of a page that needs to update based on certain  
> events. I use Ajax to do that updating. But on first loading the page,  
> that section needs to be populated. I’ve read the way to do this is  
> with partials. With partials, you can use the same method to create  
> the initial content and to do the Ajax update. Another way is to  
> simply make an Ajax call when the page first loads.
> 
> My question is which of these methods is better or is it a personal  
> preference?

The partial saves a second hit on your app.

–  
We develop, watch us RoR, in numbers too big to ignore.
