Skip to content
Snippets Groups Projects
Select Git revision
  • 289ebc5187a5f45ee98306f22a74fa735cc5af59
  • master default
2 results

index.js

Blame
  • Forked from Dr.Pirmann / CI101Week56Lab
    This fork has diverged from the upstream repository.
    user avatar
    SirMathhman authored
    289ebc51
    History
    index.js 592 B
    function goToCCI() {
        window.location.replace('https://drexel.edu/cci/')
    }
    
    
    /**
     * Week 6
     */
    function getBooks() {
        let xhr = new XMLHttpRequest();
        xhr.open("GET", "/getBooks");
        xhr.onreadystatechange=function() {
            myCallBack(xhr);
          };
        xhr.send(null);
    }
    
    function myCallBack(xhr) {
        if (xhr.readyState==4 && xhr.status==200) {
            let table = document.getElementById('book-list');
            table.innerHTML = `<tr>
            <th>Title</th>
            <th>Author</th>
            <th>ISBN</th>
            <th>Available?</th>
            </tr>` + xhr.responseText;
        }
    }