//服务端生成json数据json.php <?php $json=array("Volvo","BMW","SAAB"); $cb = $_GET[‘callback‘]; echo $cb.‘(‘.json_encode($json, true).‘)‘; ?>
//客户端Ajax请求数据
<script> $(document).ready(function() { var url="http://域名/json.php?callback=?"; $.getJSON(url,function(data){ alert(data); });
</script>