是否可以在加载时使用 Ajax 获取 PHP 类变量?单击提交时会调用我的类,我想知道加载完成后是否有任何方法可以获取警报框中的值?
编辑:
class VacationCalc {
......
function VacationLeft($date) {
$someValue = (strtotime($date) - strtotime($this->worker->vacationStartDate)) / 86400;
$rest = $someValue - $this->vacationWithoutPay;
echo $this->leftDays = number_format($this->worker->daysInyear + ($rest * ($this->worker->vacationDaysInYear / 365.25)) - $this->daysAllreadyDone,1,',',' ');
}
}
}
加载完成后,我想将值发送到警报框。