请问如何php如何返回变量+组装html给ajax
function html($select,$name){
global $pagecon;
$a='1';
$b='2';
$result='';
$result.='<ul id="thumbs">';
while($row=$select->fetch()){
$result.='<li class="'.$name.'isotope-item">';
$result.='<img src="ztImg/'.$row['riseimg'].'"width=235 height=300 alt="请教怎么php怎么返回变量+组装html给ajax"//></div><ul>';
$result.='<h3 class="title">'.$row['ztname'].'</h3>';
$result.='<span class="category">'. $row['zttype'].'</span>';
$result.='<p class="intro">推荐日期:'.$row['zttime'].'</p></div></li>';
}
$result.='</ul>';
$result.='<center><h4>'.$pagecon.'</h4></center>';
return $result,$a,$b;
}
return "$result,$a,$b";
success:function(json){
a = json.split(',');
function html($select,$name){
global $pagecon;
$a='1';
$b='2';
$result='';
$result.='<ul id="thumbs">';
while($row=$select->fetch()){
$result.='<li class="'.$name.'isotope-item">';
$result.='<img src="ztImg/'.$row['riseimg'].'"width=235 height=300 alt="请教怎么php怎么返回变量+组装html给ajax"//></div><ul>';
$result.='<h3 class="title">'.$row['ztname'].'</h3>';
$result.='<span class="category">'. $row['zttype'].'</span>';
$result.='<p class="intro">推荐日期:'.$row['zttime'].'</p></div></li>';
}
$result.='</ul>';
$result.='<center><h4>'.$pagecon.'</h4></center>';
return $result.'--'.$a.'--'.$b;//用--来连接返回
}
function getData(page){
alert('ok');
$.ajax({
type:'post',
url:'action/test.php',
data: {'pageNum':page-1},
beforeSend:function(){
$("#sss ul").append("<li id='loading'>loading...</li>");
},
success:function(json){
var arr=json.split('--');
$("#sss ul").empty();
result = arr['0']//获得来自php的变量$result
total = arr['0']//获得来自php的变量$a
pageSize = //获得来自php的变量$b
$("div#sss").html(data);
},
complete:function(){ //生成分页条
getPageBar();
},
error:function(){
alert("数据加载失败");
}
});
}