Rails 3: How to “redirect_to” in Ajax call?

Replaced below redirect method

redirect_to(:controller => 'jobs', :action => 'index')

with this:

render :js => "window.location = '/jobs/index'"

and it works fine!


Pass static url to link

= link_to ‘Set as application form’, “org_form_and_documents?id=#{params[:id]}”, :onclick => “set_as_app()”, :class => “active”

function set_as_app()
      var IDs = [];
        var each_id = ‘#’+this.id;        
        if ($(each_id).attr(‘checked’))
                 url: “/organizations/change_form”,
                 data: { form_id: this.id, org_id: $(‘#org’).val(), season: $(‘#season’).val()},
                 cache: false,                      
I hope, it will help..!!!




find index of current row


<td class=”bordercolor” >
<a href=”#” class=”up”>Up</a><br>
<a href=”#” class=”down”>Down</a>



var td= $(this).closest(‘tr’).index();