JSON Example
<?php
$arr=array('Name'=>'Manikanta',
'Mobile'=>9553517603);
echo json_encode($arr);
html page
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></sc
ript>
<script>$(function(){
$.ajax({
url:'testjson.php',
success:function(res){
dt=JSON.parse(res)
$('.name').html(dt.Name)
$('.mobile').html(dt.Mobile)
}
});
})</script>
<p>
Name : <span class='name'></span><br/>
Mobile : <span class='mobile'></span>
</p>
<?php
$arr=array('Name'=>'Manikanta',
'Mobile'=>9553517603);
echo json_encode($arr);
html page
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></sc
ript>
<script>$(function(){
$.ajax({
url:'testjson.php',
success:function(res){
dt=JSON.parse(res)
$('.name').html(dt.Name)
$('.mobile').html(dt.Mobile)
}
});
})</script>
<p>
Name : <span class='name'></span><br/>
Mobile : <span class='mobile'></span>
</p>
0 comments:
Post a Comment