Developed with love by KnpLabs Hire us for your project!
37

JQueryAjaxBundle

by kernel64

JQueryAjaxBundle for Symfony2

JQueryAjaxBundle SensioLabsInsight


Build Status Scrutinizer Code Quality

JQueryAjaxBundle for Symfony2.

Install

To install this bundle on your project, add this line to composer.json file:

   "mabs/jquery-ajax-bundle": "~1.0"

This bundle add two Twig functions:

1 - ja_request:

To generate a js code to send an ajax request:

  {{ ja_request({'update': '#reponse', 'url': path('new')  }) }}

or

{{ ja_request({'update': '#reponse', 'url': path('new'), 'after': 'alert("after");', 'before': 'alert("before");', 'complete': 'alert("complete");'  }) }}

=>
html
$.ajax({ url: "/app_dev.php/new", type: "POST", dataType: "html",beforeSend: function(){alert("before");},success: function( data ){$( "#reponse" ).html(data);alert("after");}});

2 - ja_link:

To generate a link:

  {{ ja_link({'update': '#reponse', 'url': path('new'), 'text': 'new link'  }) }}

To add a confirm action on click, you just have to use 'confirm': true, by default the text is "Are you sure you want to perform this action?"
then if you want to replace it, use 'confirm_msg': "***".

You can also use those parameters 'before' and 'after' to execute JS code.

3 - License

This bundle is available under the MIT license.

The MIT License (MIT)

Copyright (c) 2012 Mohamed Aymen Ben Slimane

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Update README.md
    By kernel64, 2 years ago
  • Update .travis.yml
    By kernel64, 2 years ago
  • Update composer.json
    By kernel64, 2 years ago
  • Update composer.json
    By kernel64, 2 years ago
  • Update composer.json
    By kernel64, 2 years ago
  • Update README.md
    By kernel64, 2 years ago
  • Update README.md
    By kernel64, 2 years ago
  • Update README.md
    By kernel64, 2 years ago
  • Update services.yml
    By kernel64, 2 years ago
  • Update JqueryAjaxExtension.php
    By kernel64, 2 years ago
  • Update .gitignore
    By kernel64, 2 years ago
  • Update JqueryAjaxExtension.php
    By kernel64, 2 years ago
  • Create phpunit.xml.dist
    By kernel64, 3 years ago
  • Update .travis.yml
    By kernel64, 3 years ago
  • Update .travis.yml
    By kernel64, 3 years ago
  • Delete phpunit.xml.dist
    By kernel64, 3 years ago
  • Update .travis.yml
    By kernel64, 3 years ago
  • Create phpunit.xml.dist
    By kernel64, 3 years ago
  • Update .travis.yml
    By kernel64, 3 years ago
  • Update README.md
    By kernel64, 3 years ago
  • Update README.md
    By kernel64, 3 years ago
  • Update README.md
    By kernel64, 3 years ago
  • add .travis.yml
    By kernel64, 3 years ago
  • Merge pull request #1 from bmustapha/patch-1
    By kernel64, 3 years ago
  • add submit form tag
    By , 3 years ago
  • Update README.md
    By kernel64, 3 years ago
  • add complete function
    By kernel64, 3 years ago
  • Update README.md
    By kernel64, 3 years ago
  • Update README.md
    By kernel64, 3 years ago
  • fix bug
    By kernel64, 3 years ago