The jquery loading method loads HTML from a remote file and injects it into the DOM. For example, to load feeds.html into a div with feed ID, you would do the following:
$("#feeds").load("feeds.html");
Is this an alternative to calling partial with the Rails replace_html method or is it different from others?
page.replace_html 'feeds', :partial => 'main/feeds', :locals => {:feed => @feed_data }
[EDIT]: As Craig Stuntz points out, replace_html returns Javascript instead of HTML - what is the advantage / disadvantage of this? Does this mean that the snippet you return has more functionality just like a web page using Javascript is more efficient than a regular HTML page? Or is there another reason to return Javascript instead of HTML?
jquery dom ajax ruby-on-rails
pez_dispenser
source share