Can't get simple link_to_remote to work

AFAICT, this is all I need to do to get a simple example working:

the <head> should have this:

   <%= javascript_include_tag :defaults %>

My test page view should have a div with an id and the ERB like this:

   <%= link_to_remote 'Click Me',
      :url => {:action => 'show_time',
      :update => 'time_box'} %>

    <div id="time_box"></div>

The controller for my test page should have this:

   def show_time
      layout false
      render_text "Time: " + DateTime.now.to_s
   end

I know there's various options for several of the details in there, but
shouldn't this example work as is?

However, I get no response from this code.

What am I missing?

Greg Willits wrote:

AFAICT, this is all I need to do to get a simple example working:

   <%= link_to_remote 'Click Me',
      :url => {:action => 'show_time',
      :update => 'time_box'} %>

ACK, found it -- the } was in the wrong spot.

Now to get a view template to be used for the response. I thought one
would just automatically get used, but apparently not?

Greg Willits wrote:

Greg Willits wrote:

AFAICT, this is all I need to do to get a simple example working:

   <%= link_to_remote 'Click Me',
      :url => {:action => 'show_time',
      :update => 'time_box'} %>

ACK, found it -- the } was in the wrong spot.

Now to get a view template to be used for the response. I thought one
would just automatically get used, but apparently not?

Oi. sorry. ignore that.

Greg,

Glad to see you got this working! I used to encounter the same types
of things... weird errors that turned out to be obscure syntactic
mistakes (like a wrongly placed or missing } in your example).

In these cases, the API docs are indispensible.. to know when you need
a hash or a hash of hashes, or stuff like that.

-Danimal