1

I have multiple Ajax calls like

(async function(){
  await $.ajax({
          ...
  });
 ... next Ajax call 
 ...
})();

They working fine when i call them from a previous page and land on the scripting Ajax handler site.

But i want that the user dont get shown this page, so i tryed to add

header('Location: ' . $_SERVER['HTTP_REFERER']);

that the user get directed to the source page where he submitted.

Maybe Problems with the await async? I have no alerts or something on the Ajax call Page its just a blank site.

thx for help.

Daniel
  • 668
  • 4
  • 17
  • 1
    HTTP_REFERER is only set by browsers when following a link, and not always then. You can't rely on it being accurate, or even present in anything you might want to do. –  May 25 '19 at 10:00
  • Try add a header with referer in ajax request: https://stackoverflow.com/questions/8798706/set-referer-url-with-ajax-request/16065622 – CoursesWeb May 25 '19 at 10:17
  • @CoursesWeb `var referrer = "prev_page.php";` and adding `headers: {'X-Alt-Referer': referrer },` to the ajax not working i still end up on the Ajax handler php page – Daniel May 25 '19 at 11:11

0 Answers0