1.html
ajax学习
aaaaaaaaaaaaaaa
_1.php
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
function carinfo(car_custid){
$.ajax({
type: "post",
url: "_car_info.php",
dataType:"text",
data:{
"e_cust":car_custid,
},
success: function(msg){
if(msg==2){
$("#tab_catinfo").html("该客户暂无车源!");
}else{
$("#tab_catinfo").html(msg);
}
//alert(msg);
},
error: function(){
//请求出错处理
alert("error");
}
});
}
php
$e_cust=$_POST['e_cust'];
$sql="SELECT `sellid`,`brand`, `model`, `style`, `yanse`,`recdate` FROM `vcarlist` WHERE `custid`='".$e_cust."' order by sellid DESC limit 10";
$result=$db->getAll($sql);
//echo json_encode($result);
//echo json_encode($sql);
//json_encode
if($result){
echo <
编号
品牌
车系
型号
颜色
录入时间
carinfo;
// echo "
";
// echo "".客户车源确认."";
// echo "";
// echo "
";
// echo "".编号."";
// echo "".品牌."";
// echo "".车系."";
// echo "".型号."";
// echo "".颜色."";
// echo "".录入时间."";
// echo "";
foreach($result as $val){
echo "
";
echo "".$val['sellid']."";
echo "".$val['model']."";
echo "".$val['style']."";
echo "".$val['yanse']."";
echo "".$val['recdate']."";
echo "";
}
}else{
echo "2";
}
?>