Rosh
Rosh

Reputation: 731

how to reload a page after closing modal dialog box in rails?

I have a modal dialog box with form. I want to reload the page after closing the modal dialog box. How can I do this in Rails controller? plz help me... I am using rails 2.3.8 and following is my controller code for update a form.

def update
  @event = Event.find(params[:id])
  render :update do |page|
    if @event.update_attributes(params[:event])
      page<<"$j('#show_event_dialog').dialog('destroy')" 
      redirect_to :controller => 'calendar', :action => 'index'
     end 
  end
end

but this will return internal server error. How can I redirect to main page with the updated values?

Upvotes: 0

Views: 1737

Answers (1)

Rosh
Rosh

Reputation: 731

I did this as follows...

 page << 'window.location.reload()'

Now it is refreshing the page...

Upvotes: 1

Related Questions