rendering fails (Ajax - problem?)

Hi Christian,

Christian Rolle wrote:

I have a link_to_remote() in my view which activates an action (say "filter()"). In this action something is done (maybe a "Test.find(:all)"). Now I want to pass these items to another action (I made it with render(:action => 'list')), which paginates theses items and loads the view, that belongs to the action. But because of Ajax no
view is visible. I have no clue why.

The key is to understand what you're trying to do in the context of the Rails request/response cycle. It's also somewhat important to understand that a Rails app 'lives' for exactly *one* request/response cycle. Rails treats*every* request as though it was the first it's heard of anything. In this case, the browser has sent a request to the server that tells the server, via the message type, that it expects an executable response. The server, on the other hand, will send back whatever your application tells it to send back. If you tell your app to send back html instead of js, it will. And the browser will 'execute' the html which will result in exactly what you're seeing: nothing.

Maybe the second action (list) is never rendered?

I recommend you download and begin using Firebug. Then you'll be able to see exactly what's being requested and rendered. You are using Firefox, aren't you?

But how is it possible to realise this request?

To get a good start, I recommend Cody Fauser's RJS tutorial on O'Reilly. Excellent material at a 'duh' price.

Any hint would be great.


PS. If you decide you want more than a hint, feel free to ask :wink: It's a very helpful list.