Convert JSON To HTML jQuery Miranda - Download Convert JSON Data to HTML - jQuery Miranda.js

Download Convert JSON Data to HTML – jQuery Miranda.js

Posted on

This time I will share jQuery Plugin and tutorial about Convert JSON Data to HTML – jQuery Miranda.js, hope it will help you in programming stack.

Convert JSON To HTML jQuery Miranda - Download Convert JSON Data to HTML - jQuery Miranda.js

File Size: 13.6 KB
Views Total: 5437
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Miranda.js is a lightweight jQuery plugin that makes it possible to convert JSON objects into HTML data via AJAX GET or POST requests. Check out more complex example pages in the zip.

Installation:

1 # NPM
2 $ npm install miranda-js --save

Basic usage:

1. Load the latest version of jQuery JavaScript library (slim build is recommended) and jQuery Miranda.js script in your html document.

2         integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
3         crossorigin="anonymous"></script>
4 <script src="js/jquery.miranda.js"></script>

2. Prepare your JSON data as follows:

1 var data = {"name": "jQuery", "lastname": "Script"};

3. Create the JSON template as follows:

1 <div id="demo">
2   <h1>[[name]]</h1>
3   <h2>[[lastname]]</h2>
4 </div>

4. The JavaScript to convert the JSON data into html.

1 $("#demo").mirandajs(data);

5. The plugin also supports JSON arrays

1 <select id="countryList" style="display: none;">
2   <option>[[name]]</option>
3 </select>
1 var country_list = [
2     {"name":"Afghanistan"},
3     {"name":"Brazil"},
4     {"name":"Belgium"},
5     {"name":"Costa Rica"},
6     {"name":"France"},
7     {"name":"Zimbabwe"}
8 ];
9 $("#countryList").mirandajs(country_list);

6. Default plugin settings.

01 $("#demo").mirandajs(data,{
02   jsonNode:[''],
03   containers:[this.attr('id')],
04   effect:'show', // show, fadeIn and slideDown
05   delay:1000,
06   nodeDelay:500,
07   ajaxMethod:'GET',
08   postData:{},
09   noCache: false
10 });

This awesome jQuery plugin is developed by fabiano-miranda. For more Advanced Usages, please check the demo page or visit the official website.

source : jqueryscript.net