dev-master
9999999-dev https://github.com/Valantir007/AjaxEngineBundleEngine to sends all requests to server via ajax
MIT
by Valantir
symfony2 bundle ajax engine
Engine to sends all requests to server via ajax
To install bundle in your project, add below line to your composer.json file:, (*1)
// composer.json { // ... "require": { // ... "valantir/ajaxenginebundle": "dev-master" } }
NOTE: Please replace dev-master with the latest stable version, for example 1.0.1., (*2)
Then install bundle by running update command:, (*3)
$ php composer.phar update valantir/ajaxenginebundle
Now you need to add bundle to your AppKernel.php file:, (*4)
<?php // in AppKernel::registerBundles() $bundles = array( // ... new Valantir\AjaxEngineBundle\AjaxEngineBundle(), // ... );
If you want to flash messages will be send to browser as header add below code to your config.yml file., (*5)
ajax_engine: flash_messages: type: header #header or html - if header then flash messages are in header "Flash-Messages" in json format
Now each template files need to extends layout.html.twig file existing in AjaxEngineBundle. Add this line to first line in your file, (*6)
{% extends "AjaxEngineBundle::layout.html.twig" %}
All content need to be in content block like this:, (*7)
{% block content %} {# your twig code #} {% endblock content %}
Bundle uses jQuery 1.11.2 and modernizr in version 2.8.3., (*8)
Tested on : - Chrome 43, - FireFox 38, - Opera 30.0, - Safari 5.1.7, - IE 11, (*9)
Event name | Description | Parameters |
---|---|---|
beforeAddClass | calls before engine add class "engine-on" to links and forms | - |
afterAddClass | calls after engine add class "engine-on" to links and forms | - |
beforeDone | calls before ajax done function - before data from request will be added to ajax-container | parameters = [{'response': response, 'status': status, 'xhr': xhr}] |
afterDone | calls after ajax done function - after data from request will be added to ajax-container | parameters = [{'response': response, 'status': status, 'xhr': xhr}] |
beforeAlways | calls before ajax always function | parameters = [{'response': response, 'status': status, 'xhr': xhr}] |
afterAlways | calls after ajax always function | parameters = [{'response': response, 'status': status, 'xhr': xhr}] |
beforeSend | calls before ajax beforeSend function | parameters = [{'xhr': xhr: 'settings': settings}] |
Engine to sends all requests to server via ajax
MIT
symfony2 bundle ajax engine