A simple and lightweight Javascript function to load your ajax content using HTML data-* attribute.
- Coffee and love.
- Copy ajax-load.min.js (located at /dist folder) into your project
- Then, before your closing
<body>
tag add:<script type="text/javascript" src="/your/path/to/fle/ajax-load.min.js"></script>
- Enjoy!
- Load ajax content via data-* HTML attribute
- Load ajax content via javascript function
- Trigger action on click
- Trigger action on load page
- Destroy previously loaded content
- Callbacks
Ajax Load
<a href="#content-link-goes-here" data-ajax-load="#container-id-goes-here" data-ajax-callback="yourCallbackFunction()">Load content</a>
Ajax Destroy
<button type="button" data-ajax-destroy="#item-id-goes-here" data-ajax-callback="yourCallbackFunction()">Destroy item</button>
- Use it as plugin
- Improve documentation