Hi Everybody!
I have an ajax request, it will replace a div content with partial file
like below.
render :update do |page|
  page.replace_html :track_info, :partial =>"shared/trackinfo"
end
Here i want to check whether the div exists or not, before replacing its
content. Like below
if $(''track_info'')
 $(''track_info'').innerHTML="playlist info partial
content"
else
 #do nothing.
Can anyone suggest me conditional ajax statement for the above
condition.
Thanks in advance.
T.Veeraa
-- 
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 post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Maybe you can try the below one:
page.select("#track_info").each do |value|
   page.replace_html "track_info", :partial =>
"shared/trackinfo"
end
On Feb 2, 2008 5:07 PM, Veera Sundaravel
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:
>
> Hi Everybody!
>
> I have an ajax request, it will replace a div content with partial file
> like below.
>
> render :update do |page|
>  page.replace_html :track_info, :partial =>"shared/trackinfo"
> end
>
> Here i want to check whether the div exists or not, before replacing its
> content. Like below
>
> if $(''track_info'')
>  $(''track_info'').innerHTML="playlist info partial
content"
> else
>  #do nothing.
>
> Can anyone suggest me conditional ajax statement for the above
> condition.
>
>
> Thanks in advance.
> T.Veeraa
> --
> 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 post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
sishen wrote:> Maybe you can try the below one: > > page.select("#track_info").each do |value| > page.replace_html "track_info", :partial => "shared/trackinfo" > end > > On Feb 2, 2008 5:07 PM, Veera Sundaravel > <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>Hi sishen, Its working thanks for your kind reply. Regards, T.Veeraa. -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---