testapi.js
/*
Function calling the API to get the list of all user who have a library on the server
It creates a list
 */
Function calling the API to get the list of all user who have a library on the server
It creates a list
Function calling the API to get the list of all user who have a library on the server It creates a list
function user_list() {
    $.ajax({
        type: 'GET',
        url: './library.php',
        success: function (response){
            $("#select_users").empty();
            $("#list_users").empty();
            let ul = document.createElement('ul');
            let selectList = document.getElementById('select_users');
            document.getElementById('list_users').appendChild(ul);
            response.forEach(function(name){
                let li = document.createElement('li');
                ul.appendChild(li);
                li.innerHTML += name;
                let option = document.createElement("option");
                option.value = name;
                option.text = name;
                selectList.appendChild(option);
            });
        },
        error: function(xhr, status, error) {
            alert(error);
        }
    })
}
function user_list ( ) { $ . ajax ( { type : 'GET' , url : './library.php' , success : function ( response ) { $ ( "#select_users" ) . empty ( ) ; $ ( "#list_users" ) . empty ( ) ; let ul = document . createElement ( 'ul' ) ; let selectList = document . getElementById ( 'select_users' ) ; document . getElementById ( 'list_users' ) . appendChild ( ul ) ; response . forEach ( function ( name ) { let li = document . createElement ( 'li' ) ; ul . appendChild ( li ) ; li . innerHTML += name ; let option = document . createElement ( "option" ) ; option . value = name ; option . text = name ; selectList . appendChild ( option ) ; } ) ; } , error : function ( xhr , status , error ) { alert ( error ) ; } } ) }
Function calling the API to get the list of all user who have a library on the server
It creates a list
Function calling the API to get the list of all user who have a library on the server It creates a list