-
Notifications
You must be signed in to change notification settings - Fork 16
Basics usage
#Basics usage
Here are some basic steps for start using this library.
Download latest version of the library and connect to the site:
<script type="text/javascript" src="patch/to/library/fullajax.js"></script>
<script type="text/javascript">
//here will be configuration for fullajax
</script>
Then need add ID for the block in the template where the content will be updated via AJAX. In most cases this already done when creating a template.
<div id="forFullAjax">
<!-- Here some content that will be updated. -->
</div>
All response to AJAX requests will be placed in this block. Therefore the server must to return only the desired content, not the entire site (About it bottom).
Now, need add the basic links filtering options, and add some other advanced options for FullAJAX. Example configuration:
FLAX.Filter.add({url:'/', id:'forFullAjax'});
FLAX.linkEqual[':ax:forFullAjax:'] = ':';
FLAX.directLink();
The first line it a filter definition, and indicates that all internal links that which starts at a ‘/’ will be converted into AJAX-links. Parameter “id” – a block identifier, where will be updated content. Additional options can be found in "About HAX HtmlAjaX" article.
Second row converts “: ax: forFullAjax:” in “:” in address line - build AJAX link.
The third line need for normal work of the AJAX links, when someone will try open AJAX link on other tab/browse