Forum: Ruby on Rails JQuery Ajax problem=Weird- works once stops next

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Preethi S. (Guest)
on 2009-04-24 15:29
Hi,
I'm facing a weird problem with jquery and ajax calls.

I've a page which has a search box and also a listin which says "join".

Search uses Ajax calls.
Join uses jquery call which opens a thickbox.

for the first time when page is loaded, thickbox works perfectly.
But after i do search and then with the searched results if i do "join",
thick box stops working.

I've added thickbox.js
then jQuery.noConflict()
and then prototype.js

I find this order to be perfect to avoid any conflicts.

Is there any thing am missing?
Can anyone help?
Thanks in advance.
Preethi S. (Guest)
on 2009-04-24 17:15
Preethi S. wrote:
> Hi,
> I'm facing a weird problem with jquery and ajax calls.
>
> I've a page which has a search box and also a listin which says "join".
>
> Search uses Ajax calls.
> Join uses jquery call which opens a thickbox.
>
> for the first time when page is loaded, thickbox works perfectly.
> But after i do search and then with the searched results if i do "join",
> thick box stops working.
>
> I've added thickbox.js
> then jQuery.noConflict()
> and then prototype.js
>
> I find this order to be perfect to avoid any conflicts.
>
> Is there any thing am missing?
> Can anyone help?
> Thanks in advance.

Added by me:
I proceeded one step further and found the reason of this problem.
The reason is
I'm doing page.replace_html to place my listing where i'm having the
"join" button.


My thickbox.js is having a document.ready ready function which prepares
are the places where thick box has to be applied.
When i do search, document.ready is not called. So links are not
identified.Thats why.

Now i found the problem but i dont know how to solve it.
I've added
<%= javascript_include_tag 'thickbox.js'%>
in my partial also. Still it is not calling the ready function eveytime
i do search.
HOw to solve it? does anyone have a solution.
Thanks
This topic is locked and can not be replied to.