On Mon, Mar 2, 2009 at 11:31 PM, Difei Zhao <[email protected]> wrote: > > Greetings all, > > I think many fellow rails developers are using jquery extensively now > and some one may already solved my problem: > > rails' RJS facility has helper methods like "replace_html", they > allowed you to render partials in the .rjs file and execute the > javascript which updates the page, how can I do that using jquery? > Thanks in advance!
I have this in my application.html.erb <script src="/javascripts/prototype.js" type="text/javascript"></script> <script src="/javascripts/effects.js" type="text/javascript"></script> <script src="/javascripts/dragdrop.js" type="text/javascript"></script> <script src="/javascripts/controls.js" type="text/javascript"></script> <script src="/javascripts/jquery.js" type="text/javascript"></script> <script src="/javascripts/jquery-ui.js" type="text/javascript"></script> <script src="/javascripts/application.js" type="text/javascript"></script> I have this in my application.js: var $j = jQuery.noConflict(); This puts the jQuery instance into it's own namespace, leaving the $ object from prototype alone. And then in an rjs template I can do things like: page.replace_html 'pane_content', :partial => 'message/sent_pane' page << "$j($j.fn.nyroModal.settings.openSelector).nyroModal();" The page object still processes Javascript, no matter what library you use. -- Greg Donald http://destiney.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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

