标签:http java 使用 os io 2014 ar cti
客户端:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<script src="http://img1.tuniucdn.com/j/201406191714/3rd/jquery-1.7.2.min.js"></script>
<!-- <script src="../js/require.js" data-main="../js/main"></script> -->
<script type="text/javascript">
function cjCallback(result){
console.log(result.Name);
}
$.get(‘http://localhost/html/index.php?jsonp_callback=cjCallback‘,function(){},"jsonp");
</script>
</body>
</html>
服务器端:
<?php
header(‘Content-Type:text/json;charset=utf-8‘);
$str = array
(
‘Name‘=>‘xiaolou‘,
‘Age‘=>20
);
$jsonencode = json_encode($str);
echo $_GET["jsonp_callback"]."(".$jsonencode.")";
?>
标签:http java 使用 os io 2014 ar cti
原文地址:http://www.cnblogs.com/junxizai/p/3897352.html