On local host all my ajax calls are working perfectly, but as soon as i uploaded my website online ajax call is returning a 500 internal server error
i tried to change the url in my js file but it didn't work
this is my js code
function getCode() {
  $.ajax({
    type: "GET",
    url: "/ajax.php",
    data: "fn=getCode",
    dataType: "html",
    async: true,
    success: function(msg) {
      msg = msg.split(" - ");
      //console.log(msg[1]);
      if (msg[0] === "success") {
        document.getElementById("hiddencode").value = msg[1];
        alert(msg[1]);
      }
      if (msg[0] === "error") {
        alert("Unable to get Code try again!");
      }
    },
    error: function(XMLHttpRequest, textStatus, errorThrown) {
      //console.log("Unable to connect to Ajax file");
      console.log(errorThrown);
    }
  });
}
this is my ajax.php code
if (isset($_GET['fn'])) {
    if ($_GET['fn'] === "getCode") {
        $generated_code = getCode();
        echo "success - " . $generated_code;
    } else {
        echo 'error - ';
    }
}
function getCode()
{
    return rand(1000, 9999);
}
if (isset($_GET['fun'])) {
    if ($_GET['fun'] === 'updateListName') {
        updateListName();
    }
}
this is the error code in the inspector
jquery.min.js:2 GET http://listapp.xyz/ajax.php?fn=getCode 500 (Internal Server Error)
send @ jquery.min.js:2
ajax @ jquery.min.js:2
getCode @ script.js:74
onclick @ forgot-pass.php:66
script.js:95 Internal Server Error
Any help would be appreciated thanks in advance
