Data update in place with jQuery only configuration html5 data attribute.
Pull request Compare This branch is 3 commits behind macndesign:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
myajax
.gitignore
README.md
jquery-data-ajax-place-update.js

README.md

jquery-data-ajax-place-update

Data update in place with jQuery only configuration html5 data attribute.

Installation

Include script after the jQuery library:

<script src="/path/to/jquery-data-ajax-place-update.js"></script>

Usage

Configure attributes in the link tag:

<a data-ajax='{"update": "#mysrc", "place": "#content"}' href="/test/">Test</a>
<div id="mysrc"></div>

Attributes legend:

  • update: HTML element to be inserted content.
  • place: Piece you want to capture of the link.

Define the resources in HTML page, inside of a script tag:

var $resources = {
    'load_image': '<img class="loader" src="/path/to/img/loader.gif" alt="Loading...">',
    'urlerror': '/error/',
    'url404': '/error-404/',
    'url500': '/error-500/'
}

Authors

Extra

A basic django project myajax with the jQuery script integrated.

Enjoy!