Jquery Json

How to dispaly json data using jquery?

JSON (Java Script Object Notation) is a lightweight data passing format and human readable contains java structures. In this post I want to explain Creating JSON file with PHP and Display JSON data using jquery and Ajax. Using JSON we can interchange data between the browsers and the server.

 JSON Structure

Take a look at data.js file click here

 Javascript Code

Loading data.js(json file) data using jQuery and Ajax. Take a look at live preview click here

<div id=”appendData”></div>

Load Click

Load data while clicking just replace javascript code : $(document).ready(function() to $(‘.load’).click(function()

<div id=”appendData”></div>


Creating JSON file with PHP

Database Table Posts

Contains simple PHP code.

Loading PHP file

If you want to load PHP file replace javascript code $.getJSON(“data.js”,function(data)