0){ while($row = mysqli_fetch_array($run_query)){ $">
时间:2021-07-01 10:21:17 帮助过:5人阅读
Categories
";
if(mysqli_num_rows($run_query)>0){
while($row = mysqli_fetch_array($run_query)){
$cid = $row["cat_id"];
$cat_name = $row["cat_title"];
echo "
$cat_name
";
}
echo "";
}
}
?>
//JS
$(document).ready(function() {
cat();
function cat() {
$.ajax({
url: 'action.php',
type: 'POST',
data: {
category: 1
}
})
.done(function(data) {
//console.log(data);
$("#get_category").html(data);
});
}
})
php是小白,有没有办法前后端分离,把echo的HTML代码返回json的格式给前端处理?