Normally, we render partials via views by using render
[partial_without_underscore]
. But we can also render partials in our document using ajax.To do this we need to
Create an action method that we would call to load the partial and write the following code inside the action method
layout: false will disable the loading of layouts and headers we create.
partial: “partial_form” will load the partial “_partial_form.html.erb” file.
respond_to do |format|
format.html { render partial: "partial_form", layout: false }
end
Now make an ajax call to url controller/action
Grab the data via HTTP response and render in the webpage
Also read:
- Sublime Text 3 Build 3065 License Key
- Top 5 Best Torrent Downloading 2014
- Top 5 Sites URL Shorten websites to Earn Money
- How Can You Earn Cash Online with Link Shortening WebSites
- Tricks for How to Make a WiFi Hotspot on your Windows 7/8 Laptop
- How to Import Wordpress to Blogger
- How to Install Emmet with Sublime Text 3
Thanks for this tutorial, :)
ReplyDeleteYou're Welcome :)
ReplyDelete