$.ajax({
type: "GET",
url: "http://dsfdf.com/dhus.php?callback=?",
data: {name:"sdasd"},
dataType:"jsonp",
jsonp: 'callback',
success: function(data){
if(data.son=='1'){
alert("链接成功!");
}
},
error:function(){
alert_tan("提示","失败啦");
}
});
})
在dhus.php页面中这样写
$callback = $_GET['callback'];
if($_GET['name']!=''){
$arr=array('son'=>'1');
}else{
$arr=array('son'=>'0');
}
echo $callback.'('.json_encode($arr).')';