标签:ack blog pre his fun info json inner ati
JS部分代码:
$.ajax({ url:url, dataType:‘jsonp‘, data:{title:title}, jsonp:‘callback‘, success:function(lis) { $(‘.mylist‘).html(‘‘); var txt=‘‘; for (x in lis) { txt=txt+‘<li>‘+lis[x].title+‘</li>‘; } $(‘.mylist‘).html(txt); } });
后台部分代码:
$title=‘‘; if (isset($_REQUEST[‘title‘])) { $title=trim($_REQUEST[‘title‘]); } $sql="SELECT * FROM `v9_news` as a INNER JOIN `v9_news_data` AS b ON a.id=b.id WHERE a.catid IN(2349,2372,3614,2343,2344,2345,2346) AND subtitle LIKE ‘%$title%‘"; $result = $this->db->query($sql); $info = $this->db->fetch_array($result); $callback = $_REQUEST[‘callback‘]; echo $callback.‘(‘.json_encode($info).‘)‘;exit;
标签:ack blog pre his fun info json inner ati
原文地址:http://www.cnblogs.com/mracale/p/7559735.html