Topic: Ajax Reload a div pertial

Ive been searching my ass of online for help on this with no success, every link is a php link, or with timers, or they never worked.

Can someone please help me, i am fairly new to Ror and ajax.

Can someone please give me an example oh how i can reload a partial that is contained in a div?

Re: Ajax Reload a div pertial

What version of Rails?

In 3.X

Say you have an Ajax action in your controller

def myajax
   @foobar = 'Here is some new content for my div'

And you somehow call the ajax action from your view

link_to 'doit', '/mycontroller/myajax', :remote=>true

all you have to do is create a javascript ERB file in the same view directory using the same filename prefix as the action

myajax.js.erb:  # assuming you are using query

$('mydiv').html("<%= escape_jacaScript(@foobar) %>")
Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.

Re: Ajax Reload a div pertial

Thanks for the help