if($type=='jsonp'){
$sel=$pdo->query("select * from zhoukao1 where biao like '%$title%'")->fetchAll();
$str=json_encode($sel);
$callback=$_GET['callback'];
$sel=$pdo->query("select * from zhoukao1 where biao like '%$title%'")->fetchAll();
$str=json_encode($sel);
$callback=$_GET['callback'];
echo $callback."(".$str.")";
}
jquery页面
<input type="text" name='photo'><button οnclick="Photo()">搜索</button>
<div></div>
</body>
</html>
<script>
function Photo(){
var photo= $('input[name=photo]').val();
//接口路径
var url="http://www.taotao.com/PHP_7/liuwu/zuoye/2016_7_24/xml.php?title="+photo+"&&type=jsonp&callback=?";
$.getJSON(url,function(msg){
$('div').html(msg[0]['biao']);
});
}
</script>