[Rails] Re: JS response -pls help somebody
Hi you can try
respond_to do |format|
format.js { render :js =>
"window.location.replace('#{new_product_url}');" }
end
Thanks
Manoj Menon
lekha p. wrote in post #1130416:
> Hi all,
> Pls help to find a solution :
>
> i have a form like following
> <%= form_for @product , :url => products_url(:format => 'js'), :html
> =>{:id=>"create_product_form" ,:multipart => true,:remote=>true} do |f|
> %>
>
>
> what i have to do is like when submiting form i have to redirect to new
> page else want to execute js like following
>
> def create
> if @product.save
> redirect_to new_product_path
> else
> respond_to do |format|
> format.js
> end
> end
>
>
> Here my issue i cant redirect_to new_products_path... what may be my
> mistake ?? redirection is happening in console. but not not in ui.
> whether it is because of ajax call in form, how to redirect ??
>
>
>
>
>
>
>
> Thanks,
> Lekha.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/5cd99ed8a5959df9fa951ccae27261dd%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home