我有一个简单的 ajax 调用,它返回 html 代码,
//=======-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-==-=-==-=-=-=-=
//SEARCH Submit ===============================================================================
$('.clicked_search').live("click",function() {
var from = $('#from').val();
var to = $('#to').val();
var sel = $('#sel').val();
var BegDT = new Date(from);
var EndDT = new Date(to);
var sum = BegDT - EndDT;
alert (BegDT +" b"+ EndDT +" e"+ sum);
if(sum > 0 | from == "" & to != "" | from != "" & to == ""){
$('.inv_date').show();
}
else{
$("#app_panel").html('<div id="flash" align="left" ><img src="img/clientimg/ajax.gif" align="absmiddle"> <span class="loading">Loading Request...</span></div>');
$("#clock").html('<div id="flash2" align="left" ><img src="img/clientimg/ajax.gif" height="15px" align="absmiddle"> <span class="loading"><font size="1">Loading Request...</font></span></div>');
$.ajax({
type: "POST",
url: "database/clientpanel/logs/search_call_log.php",
data: {
from: from,
to: to,
sel: sel
},
cache: false,
success: function(html){
$("#flash").hide();
$('.inv_date').hide();
$("#app_panel").append(html);
}
});
$.ajax({
url: "database/clientpanel/logs/search_clock_log.php",
cache: false,
success: function(html){
$("#flash2").hide();
$('.inv_date').hide();
$("#clock").append(html);
}
});
}
return false;
});
但我也希望它返回由 ajax 调用的 php 生成的值,
session_start();
include("../../dbinfo.inc.php");
// connect to the database
$client_id = $_SESSION['clientid'];
//===========THIS PHP VALUES RIGHT HERE===================================
$out = 0;
$in = 0;
$ext =0;
$min = 0;
$sec = 0;
//====================================================================
$query=" select * from call where client='$client_id' ORDER BY date_time DESC";
$result = $mysqli->query($query);
如何使用一个 ajax 调用返回“html 代码”和“php 值”?