function loadDepartmentEmployees(userID) {
    const xhr = new XMLHttpRequest();
    xhr.open("GET", `http://localhost/assetpro/departmentheads/getDepartmentEmployees/${userID}`, true);
    xhr.onload = function () {
      if (this.status == 200) {
        var employees = JSON.parse(this.response);
        for (var i = 0; i < employees.length; i++) {
          document.getElementById("employeeTableBody").innerHTML += `
            <tr>
              <td>${i + 1}</td>
              <td>${employees[i]["DepartmentCode"]}/EMP/${employees[i]["EmployeeID"]}</td>
              <td>${employees[i]["Name"]}</td>
              <td>${employees[i]["Gender"]}</td>
              <td>${employees[i]["jobTitle"]}</td>
              <td>
                <button class='btn btn-submit ' id='view' onClick="loadEmployee(${employees[i]["EmployeeID"]})">View</button>
              </td>
            </tr>`;
        }
      }
      console.log(employees);
    };
    xhr.send();
  }
//Loading all the employees within his department
Loading all the employees within his department
Loading all the employees within his department
function loadDepartmentEmployees(userID) {
    const xhr = new XMLHttpRequest();
    xhr.open("GET", `http://localhost/assetpro/departmentheads/getDepartmentEmployees/${userID}`, true);
    xhr.onload = function () {
      if (this.status == 200) {
        var employees = JSON.parse(this.response);
        for (var i = 0; i < employees.length; i++) {
          document.getElementById("employeeTableBody").innerHTML += `
            <tr>
              <td>${i + 1}</td>
              <td>${employees[i]["DepartmentCode"]}/EMP/${employees[i]["EmployeeID"]}</td>
              <td>${employees[i]["Name"]}</td>
              <td>${employees[i]["Gender"]}</td>
              <td>${employees[i]["jobTitle"]}</td>
              <td>
                <button class='btn btn-submit ' id='view' onClick="loadEmployee(${employees[i]["EmployeeID"]})">View</button>
              </td>
            </tr>`;
        }
      }
      console.log(employees);
    };
    xhr.send();
  }
function loadDepartmentEmployees ( userID ) { const xhr = new XMLHttpRequest ( ) ; xhr . open ( "GET" , ` ${ userID } ` , true ) ; xhr . onload = function ( ) { if ( this . status == 200 ) { var employees = JSON . parse ( this . response ) ; for ( var i = 0 ; i < employees . length ; i ++ ) { document . getElementById ( "employeeTableBody" ) . innerHTML += ` ${ i + 1 } ${ employees [ i ] [ "DepartmentCode" ] } ${ employees [ i ] [ "EmployeeID" ] } ${ employees [ i ] [ "Name" ] } ${ employees [ i ] [ "Gender" ] } ${ employees [ i ] [ "jobTitle" ] } ${ employees [ i ] [ "EmployeeID" ] } ` ; } } console . log ( employees ) ; } ; xhr . send ( ) ; }
Loading all the employees within his department
Loading all the employees within his department