cichy380 / Dynamic-Content-Section

The easier way to dynamic AJAX content in a multi section on your website.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dynamic Content Section

A jQuery plugin for easier creation of sections with dynamic content loaded using AJAX technology.

Demo

http://example.silversite.pl/dcb/demo/ (disable Adblock in your browser if you use)

Installation

Include the minified file in your project.

<script src="jquery.js"></script>
<script type="text/javascript" src="jquery.ajaxContent.min.js"></script>

Example of usage

HTML code:

<section class="ajax-content" 
         data-ajax-data='{"param1":"value1","param2":"value2"}'></section>

JavaScript code:

$(function() {
    $(".ajax-content").ajaxContent({
        url: '/api/v1/news/123/',
        method: 'GET',
    });
});

AJAX response format expected

Plugin expected response in JSON format based on JSON API Specification v1.0 with required data and html keys.

JSON code:

{"data":[{"html":"<html-code-here/>"}]}

Development

Install dependencies:

npm install

Commands:

  • npm run webpack — Compile assets for developing (with source maps, without minify)
  • npm run watch — Compile assets when file changes are made
  • npm run build — Compile and optimize the files in your assets directory

License

Code released under the MIT license.

About

The easier way to dynamic AJAX content in a multi section on your website.

License:MIT License


Languages

Language:JavaScript 100.0%