0

I have an ajax function in jquery caling a cakephp4 function. The function doesnt work as it is giving a 403 forbidden error. The error is about headers but i cant find what I need to fix this exactly.

This code runs and it does get the var (alert verifies this). Nothing works ? jquery ///

var freeassessmentid = "<?=$testid?>";
  
  $.ajax({
            url: "/freeassessments/freeasssesmenFinaltResult", //path is correct and it can be tested on its own
            method: "POST",
            dataType: "html",
            data: { freeassessmentid:freeassessmentid  },
            success: function(response) {
                //console.log(response);
                   
                  $('#display-area').append(response);  //no output
               }
               
               
               
            });

public function freeasssesmenFinaltResult($freeassessmentid=0)
 {
//debug('test');
 $html .= '<li class="listyle" style="height: auto;">hi<br/></li>';
          $html .= '</ul>';
//no output

 //https://stackoverflow.com/questions/36666256/jquery-ajax-call-results-in-error-status-403
atown99
  • 73
  • 8

0 Answers0