This time I will share jQuery Plugin and tutorial about Dynamic Content Loading Plugin With jQuery – ViaJS, hope it will help you in programming stack.
ViaJS is a lightweight, jQuery dependent JavaScript library which allows to dynamically load external html content into your webpage without reloading the current page. Based on XMLHttpRequest web API.
How to use it:
1. Load jQuery library and the jQuery ViaJS’ JavaScript in your html document.
1 |
< script src = "//code.jquery.com/jquery.min.js" ></ script > |
2 |
< script src = "lib/app.js" ></ script > |
2. Add the via-views
attribute to DIV containers where you want to fetch and place external content.
1 |
< div class = "container" id = "title" via-views>Title</ div > |
2 |
< div class = "container" id = "content" via-views>Content</ div > |
3. Specify the URLs you want to load into the DIV containers.
04 |
templateUrl: 'title.html' |
07 |
templateUrl: 'content.html' |
4. Create an anchor link that will fetch and insert the html files as displayed above into to the ‘title’ and ‘content’ containers.
1 |
< a via-link via-href = "home" >Home</ a > |
5. Initialize the ViaJS and done.
This awesome jQuery plugin is developed by abdi0987. For more Advanced Usages, please check the demo page or visit the official website.