40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
/*
|
|
* Stairway.js: a simple JavaScript privacy quiz
|
|
* Copyright © 2021 luca0N!
|
|
*
|
|
* This file is part of Stairway.js.
|
|
*
|
|
* Stairway.js is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* Stairway.js is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with Stairway.js. If not, see <https://www.gnu.org/licenses/>.
|
|
*
|
|
* E-mail contact: <luca0n@luca0n.com>.
|
|
*/
|
|
|
|
|
|
/**
|
|
* Attempts to fetch the resource file and returns it via callback.
|
|
* @param file The desired file.
|
|
* @param callback A function(string) which will be used to return the result of the requested file.
|
|
* @since 2021-05-27
|
|
*/
|
|
function sendGetRequest(file, listener){
|
|
let request = new XMLHttpRequest();
|
|
request.addEventListener('load', function(){
|
|
listener(this.responseText);
|
|
});
|
|
request.open("GET", file);
|
|
request.send();
|
|
}
|
|
|
|
|