PHP Classes

File: jsontest2.html

Recommend this page to a friend!
  Classes of Adnan Siddiqi  >  MySQL to JSON  >  jsontest2.html  >  Download  
File: jsontest2.html
Role: Auxiliary data
Content type: text/plain
Description: HTML file parsing returned JSON data
Class: MySQL to JSON
Convert data from MySQL query results into JSON
Author: By
Last change: Change of Email Address
Date: 11 years ago
Size: 1,317 bytes


Class file image Download

 Filename: jsontext2.html 
 Purpose: Example file which is calling example.php to parse JSON data on webpage
 Author: Adnan Siddiqi <> 
 License: PHP License 
 Date: Tuesday,June 21, 2006 

<title>JSON test</title>
<script language="javascript" src="json.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
//Global Variable
var req;

function fetchJSON(){
 	var url="example.php";
		req=new XMLHttpRequest();
		req=new ActiveXObject("Microsoft.XMLHTTP");
	req.onreadystatechange=parsedJSON;//call Back function
 function parsedJSON(){
 		//for OK
		eval('json = ' + req.responseText);
		var myJSONText = req.responseText.parseJSON();


<p><a href="javascript:fetchJSON();">Fetch JSON </a></p>
<strong>Value returned from Json:</strong>
<div id="jsonValue" style="color:#0000FF; font:Arial, Helvetica, sans-serif; width:100px "></div>  
For more information send a message to info at phpclasses dot org.