Apply for Zend Framework Certification Training

Jquery




Step 1 Create Index file

<table id="jsondata" class="table table-bordered table-hover" width="400" align="center">
<tr>
<th>Name</th>
<th>Email Link</th>
</tr>
</table>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
 
 	var url="read_json.php";

 	$.getJSON(url,function(data){
  		$.each(data.tutorials, function(i,post){
			var newRow = "<tr><td>"+post.name+"</td>                  
                           <td><a href='"+post.email+"'>WebLink</a></td>
                          </tr>" ;
		  	$(newRow).appendTo("#jsondata");
		});
 });
 
});
</script>

Step 2 Create  an read_json.php

<?php
  	mysql_connect("localhost","root","");
 	mysql_select_db("angularjs");
	$posts = array();
	$query = "SELECT * FROM users";
	$mq = mysql_query($query);
	while($row = mysql_fetch_assoc($mq)) {
		  $posts['tutorials'][] = $row;
	}
	echo json_encode($posts);
?>                                    

< Insert Data Using Php Mysql Jquery in Json Format Add Routes In Zend1 at Bootstrap >



Ask a question



  • Question:
    {{questionlistdata.blog_question_description}}
    • Answer:
      {{answer.blog_answer_description  }}
    Replay to Question


Back to Top