js文件
<script src='jquery.js'></script>
<script>
$(document).ready(
function()
{
$.ajax({
type:'GET',
dataType: "jsonp",
url: "http://xxx.com/xxx.php?param="+param,
success: function(jsonp)
{
alert(jsonp.uname);
}
});
});
</script>
php文件
$callback = $_GET['callback'];
$arr = array('uname'=>'xxx');
echo "{$callback}(".json_encode($arr).")";