1

I'm getting the below error when generating a user report

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

URL: site.com/js/xajax.js

And in console I see the below messages:

enter image description here

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

GetReport Function:

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();
}   
Iftikhar uddin
  • 3,117
  • 3
  • 29
  • 48

1 Answers1

1

xajax script is getting loaded over HTTP instead of HTTPS Chrome now blocks the script because you are running on a HTTPS environment.

You could fix this temporary by setting hsts headers in the htaccess

.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]

More info: https://stackoverflow.com/a/56063975/5265084

Keyboard ninja
  • 725
  • 6
  • 13