gpt4 book ai didi

javascript - 错误 : The ajax javascript file could not be loaded. 也许 URL 不正确?

转载 作者:行者123 更新时间:2023-11-30 19:34:06 25 4
gpt4 key购买 nike

生成用户报告时出现以下错误

Error: The ajax javascript file could not be loaded. Perhaps the URL is incorrect?

URL: site.com/js/xajax.js

在控制台中我看到以下消息:

enter image description here

function xajax_getReport(){return xajax.call("getReport", arguments, 1);}

获取报告函数:

public function getReport() {
$xajaxResponse = new xajaxResponse();

$this->template->assign("report", true);
$user =& User::getInstance();

//$this->template->assign("calendarMode", "noactive");
if ($user) {
$today = date("Y-m-d H:i:s");
//$doctor = $user->getDoctor();
//$doctorSettings = $doctor->getDoctorSettings();
//if ($doctorSettings->getTestTour() == 2) $this->template->assign("showAA", true);

if ($user->getSubscriptionDueDate() < $today) {
$this->template->assign("notlogin", true);
//$this->template->assign("doctor", $doctor);
}
}

// $user = User::getInstance();
// exit('here');
$doctor = $user->getDoctor();
$userState = $user->getState();
$doctorSettings = $doctor->getDoctorSettings();
if ($doctorSettings->getQuizType(1)) $this->template->assign('showBasic',1);
$states = $doctor->getStateArray();
$stateShow = false;
foreach ($states as $state) {
if ($state == $userState) {
$stateShow = true;
break;
}
}

$this->template->assign("user", $user);
$this->template->assign("doctor", $doctor);
$this->template->assign("stateShow", $stateShow);
$this->template->assign("date",$_SESSION["date"]);

if (file_exists("flash/{$user->getId()}/{$_SESSION["date"]}/paramArray")){
$lastReportParams = Patient::getReportParams($user->getId(),$_SESSION["date"]);
$allow = $lastReportParams["allow"][(NA_SITE?NA:WLA)];
}
else $allow = ($doctor->getShowGraph()==2)?in_array($user->getState(),$doctor->getShowGraphStatesCode()):$doctor->getShowGraph();
$this->template->assign("allow", $allow);

//allow user to view the report or not
$date = $_SESSION['thedate'];
if (file_exists("flash/{$user->getId()}/{$date}/allow")){
//$this->template->assign("date", $_SESSION['date']);
$this->template->assign("allow", true);
}

$content = $this->renderTemplate("patient/test_result.tpl");

$xajaxResponse->addAssign("cont", "innerHTML", $content);
$xajaxResponse->addAssign("loader", "style.display", "none");
$exJS = HttpSession::get("exJS");
$errors = HttpSession::get("errors");
if ($errors)
$xajaxResponse->script("document.getElementById('pr_rep_ref').style.display = 'none';
document.getElementById('pr_rep').style.display = 'none';");
$xajaxResponse->script(HttpSession::get("exJS"));
// $xajaxResponse->addScriptCall("createFlash", "");


return $xajaxResponse->getXML();
}

最佳答案

xajax 脚本正在通过 HTTP 而不是 HTTPS 加载Chrome 现在会阻止该脚本,因为您在 HTTPS 环境中运行。

您可以通过在 htaccess 中设置 hsts header 来临时修复此问题

.htaccess

Header set Strict-Transport-Security "max-age=31536000" env=HTTPS
Header set Content-Security-Policy "upgrade-insecure-requests"
RewriteCond %{HTTPS} !=on
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301]

更多信息:https://stackoverflow.com/a/56063975/5265084

关于javascript - 错误 : The ajax javascript file could not be loaded. 也许 URL 不正确?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56129800/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com