Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/filamentgroup/Ajax-Include-Pattern
An Ajax-Include Pattern for Modular Content
https://github.com/filamentgroup/Ajax-Include-Pattern
Last synced: 6 days ago
JSON representation
An Ajax-Include Pattern for Modular Content
- Host: GitHub
- URL: https://github.com/filamentgroup/Ajax-Include-Pattern
- Owner: filamentgroup
- License: mit
- Archived: true
- Created: 2012-03-27T15:28:34.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2022-08-30T21:45:37.000Z (about 2 years ago)
- Last Synced: 2024-08-10T23:25:21.539Z (3 months ago)
- Language: JavaScript
- Homepage: http://filamentgroup.com/lab/ajax_includes_modular_content/
- Size: 405 KB
- Stars: 625
- Watchers: 42
- Forks: 50
- Open Issues: 0
-
Metadata Files:
- Readme: README-plugins.md
- License: LICENSE
Awesome Lists containing this project
README
## HijaxInclude with Forms
If you include `src/ajaxIncludeForms.js` (or `dist/ajaxIncludePlugins.js`) and `$(...).serialize()` is available, you can also use HijaxInclude with forms to hijack the submit event.
### HTML
### JavaScript
$( "form[data-interaction]" ).bind( "submit", function() {
$( this ).removeAttr( "data-interaction" ).ajaxInclude();
return false;
});## Header Hooks
If you include `src/ajaxIncludeHeaderHooks.js` (or `dist/ajaxIncludePlugins.js`), you can execute JavaScript when a specific HTTP Header is returned to the XHR object.
### JavaScript
// Example: Redirect to the url returned by the
// X-AjaxInclude-Redirect header.
$( el ).ajaxInclude({
headerHooks: {
'X-AjaxInclude-Redirect': function( url ) {
window.location.href = url;
}
}
});