I'm removing Prototype from my Rails 3 app in exchange for jQuery and trying to figure out how my controller should update part of the html page without using this Prototype helper:
page.replace_html( "content", :partial => "day" )
Since you've upgraded to Rails 3, you're on a great track to also stop using RJS. Use callbacks on the AJAX method to do the replacing. For example:
Ajax call:
$.ajax(
url: "/things/one",
type: "GET",
complete: function(response, status) {
$('#content').html(response);
}
);
Then in the controller:
class ThingsController
def one
respond_to do |format|
format.js { render :partial => "day" }
end
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With