views:

192

answers:

1

Hi, I'm struggling to find suitable alternatives for methods in Prototype (converting to JQuery) and wondered if you guys could offer suitable replacements.

The RJS code I'm refactoring is:

 if request.post? && @success
    page << "window.location.href='/news'"
 else
    page.replace_html :user_overlay, :partial => 'login'
      if @error_msg.blank?
     page.visual_effect :appear, 'user_overlay', :duration => '0.7'
    else
     page.replace_html 'overlay_messages', @error_msg
     page.visual_effect :highlight, 'overlay_messages', :startcolor => "#404040", :endcolor => "#666666"
    end

It's loaded via a partial, and replaces elements in a div [login errors], we're running Ruby on Rails with JQuery.

A: 

I'd recommend installing the plugin jRails.

I've been using it for a while now with RJS without any issues what so ever. Perfect drop in replacement for prototype.

Ben