Ajax made easy. Updates the elements by diffing.
<script src="//code.jquery.com/jquery-1.11.3.min.js" type="text/javascript"></script>
<script src="//cdn.jsdelivr.net/diffdom/0.0.1/diffdom.min.js" type="text/javascript"></script>
<script src="//cdn.rawgit.com/webino/diffhtml-jquery/develop/src/diffhtml.jquery.js" type="text/javascript"></script>
Add those dependencies above and the following script to your index.html
file:
<script src="//cdn.rawgit.com/webino/webino-ajax-jquery/develop/src/webino.ajax.jquery.js" type="text/javascript"></script>
Ajax navigation HTML element:
<nav class="ajax"><a href="example.json">Click me!</a></nav>
Ajax link HTML element:
<nav class="ajax"><a href="example.json">Click me!</a></nav>
<a class="ajax" href="example.json">Click me!</a>
Ajax fragment HTML:
<div id="my-content">Text example...</div>
Expected JSON structure:
{
"fragments": {
"#my-content": "<div id=\"my-element\">Text example updated...</div>"
}
}
This package is used by the Webino™ project.
Please, report any issues and don't hesitate to contribute.