标签:style blog http io color ar 使用 sp 数据
//jquery部分的代码
1 $.ajax({ 2 type:‘GET‘, 3 url:"http://192.168.0.224/jsonp.php", 4 data:"", 5 dataType:‘jsonp‘, 6 jsonp: ‘callback‘, 7 timeout: 2000, 8 success:function(res){ 9 alert(res.info); 10 } 11 });
//php部分的代码
1 <?php 2 header(‘Content-Type:text/json;charset=utf-8‘); 3 $str = array 4 ( 5 ‘info‘=>‘aaaa‘ 6 ); 7 $result = json_encode($str); 8 $callback=$_GET[‘callback‘]; 9 echo $callback."($result)"; 10 ?>
标签:style blog http io color ar 使用 sp 数据
原文地址:http://www.cnblogs.com/kingbin/p/4059344.html