Ajax call not seen as a remote call; UJS in rails 2.3.8

I’ve applied ujs in rails 2.3.8 (I followed
http://andrewcox.org/post/507032751/rails-3-0-unobtrusive-ajax-in-rails-2-3-x)
and the controller, when answering the ajax call, seems to render
show.html.haml, not show.js.erb. What can I do to make the ajax call be
seen
as a “remote” call? Take a look at lines 13-19.

Thanks,
Ramon T.

Ramon T. wrote in post #955501:

I’ve applied ujs in rails 2.3.8 (I followed
http://andrewcox.org/post/507032751/rails-3-0-unobtrusive-ajax-in-rails-2-3-x)
and the controller, when answering the ajax call, seems to render
show.html.haml, not show.js.erb. What can I do to make the ajax call be
seen
as a “remote” call? Take a look at lines 13-19.

http://gist.github.com/634533

I believe that your Ajax call would have to request the JavaScript MIME
type.

But don’t do this. js.erb should IMHO always be seen as a design
problem. Use static JavaScript files that read dynamic content from the
DOM.

Thanks,
Ramon T.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

On Wed, Oct 20, 2010 at 1:11 AM, Marnen Laibow-Koser
[email protected]wrote:

I believe that your Ajax call would have to request the JavaScript MIME
type.

Thanks Marnen.

But don’t do this. js.erb should IMHO always be seen as a design
problem. Use static JavaScript files that read dynamic content from the
DOM.

That’s definitely different from the way I’ve been learning. It’s a bit
late, so I’ll sleep on it and research about this being a design
problem.
:slight_smile:

Ramon T.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs