function Ajax() {

	/*
	 * Sends an Ajax request to the server.
	 *
	 * Parameters:
	 * - method (string): The request method (e. g. 'GET', 'POST', ...).
	 * - url (string): The request URL.
	 * - data (string): Data to be passed along the request (e. g. form data).
	 * - mimeType (string): Content type (MIME type) of the content sent to the server.
	 * - callback (function): The function to be called when a response is
	 *	returned from the server.
	 * - block (boolean): Whether the site should be blocked.
	 *
	 * Returns: Nothing.
	 */
	this.request = function(method, url, data, mimeType, callback, block) {
		const xhr = new XMLHttpRequest();

		/*
		 * Event handler for ReadyStateChange event.
		 */
		xhr.onreadystatechange = function() {
			helper.blockSite(block);

			/*
			 * If we got a response, pass the response text to
			 * the callback function.
			 */
			if (this.readyState === 4) {

				/*
				 * If we blocked the site on the request,
				 * unblock it on the response.
				 */
				if (block) {
					helper.blockSite(false);
				}

				/*
				 * Check if callback is registered.
				 */
				if (callback !== null) {
					const content = xhr.responseText;
					callback(content);
				}

			}

		};

		xhr.open(method, url, true);

		/*
		 * Set MIME type if requested.
		 */
		if (mimeType !== null) {
			xhr.setRequestHeader('Content-type', mimeType);
		}

		xhr.send(data);
	};

	/*
	 * Requests an image from the server.
	 *
	 * Parameters:
	 * - url (string): The request URL.
	 * - data (string): Data to be passed along the request (e. g. form data).
	 * - callback (function): The function to be called when a response is
	 *	returned from the server.
	 * - block (boolean): Whether the site should be blocked.
	 * - id (integer): The id for this image request.
	 *
	 * Returns: Nothing.
	 */
	this.requestImage = function(url, data, callback, block, id) {
		helper.blockSite(block);
		const img = new Image();

		/*
		 * Event handler for load event.
		 */
		const eventSuccess = function() {

			/*
			 * If we blocked the site on the request,
			 * unblock it on the response.
			 */
			if (block) {
				helper.blockSite(false);
			}

			/*
			 * Check if callback is registered.
			 */
			if (callback !== null) {
				callback(img, id);
			}

		};

		/*
		 * Event handler for error event.
		 */
		const eventError = function() {

			/*
			 * If we blocked the site on the request,
			 * unblock it on the response.
			 */
			if (block) {
				helper.blockSite(false);
			}

			/*
			 * Check if callback is registered.
			 */
			if (callback !== null) {
				callback(null, id);
			}

		};

		img.onload = eventSuccess;
		img.onerror = eventError;
		const uri = url + '?' + data;
		img.src = uri;
	};

}
/*
 * A class implementing an Ajax engine.
 */
A class implementing an Ajax engine.
A class implementing an Ajax engine .
function Ajax() {
	this.request = function(method, url, data, mimeType, callback, block) {
		const xhr = new XMLHttpRequest();
		xhr.onreadystatechange = function() {
			helper.blockSite(block);
			if (this.readyState === 4) {
				if (block) {
					helper.blockSite(false);
				}
				if (callback !== null) {
					const content = xhr.responseText;
					callback(content);
				}
			}
		};
		xhr.open(method, url, true);
		if (mimeType !== null) {
			xhr.setRequestHeader('Content-type', mimeType);
		}
		xhr.send(data);
	};
	this.requestImage = function(url, data, callback, block, id) {
		helper.blockSite(block);
		const img = new Image();
		const eventSuccess = function() {
			if (block) {
				helper.blockSite(false);
			}
			if (callback !== null) {
				callback(img, id);
			}
		};
		const eventError = function() {
			if (block) {
				helper.blockSite(false);
			}
			if (callback !== null) {
				callback(null, id);
			}
		};
		img.onload = eventSuccess;
		img.onerror = eventError;
		const uri = url + '?' + data;
		img.src = uri;
	};
}
function Ajax ( ) { this . request = function ( method , url , data , mimeType , callback , block ) { const xhr = new XMLHttpRequest ( ) ; xhr . onreadystatechange = function ( ) { helper . blockSite ( block ) ; if ( this . readyState === 4 ) { if ( block ) { helper . blockSite ( false ) ; } if ( callback !== null ) { const content = xhr . responseText ; callback ( content ) ; } } } ; xhr . open ( method , url , true ) ; if ( mimeType !== null ) { xhr . setRequestHeader ( 'Content-type' , mimeType ) ; } xhr . send ( data ) ; } ; this . requestImage = function ( url , data , callback , block , id ) { helper . blockSite ( block ) ; const img = new Image ( ) ; const eventSuccess = function ( ) { if ( block ) { helper . blockSite ( false ) ; } if ( callback !== null ) { callback ( img , id ) ; } } ; const eventError = function ( ) { if ( block ) { helper . blockSite ( false ) ; } if ( callback !== null ) { callback ( null , id ) ; } } ; img . onload = eventSuccess ; img . onerror = eventError ; const uri = url + '?' + data ; img . src = uri ; } ; }
A class implementing an Ajax engine.
A class implementing an Ajax engine .
/*
	 * Sends an Ajax request to the server.
	 *
	 * Parameters:
	 * - method (string): The request method (e. g. 'GET', 'POST', ...).
	 * - url (string): The request URL.
	 * - data (string): Data to be passed along the request (e. g. form data).
	 * - mimeType (string): Content type (MIME type) of the content sent to the server.
	 * - callback (function): The function to be called when a response is
	 *	returned from the server.
	 * - block (boolean): Whether the site should be blocked.
	 *
	 * Returns: Nothing.
	 */ /*
		 * Event handler for ReadyStateChange event.
		 */ /*
			 * If we got a response, pass the response text to
			 * the callback function.
			 */ /*
				 * If we blocked the site on the request,
				 * unblock it on the response.
				 */ /*
				 * Check if callback is registered.
				 */ /*
		 * Set MIME type if requested.
		 */ /*
	 * Requests an image from the server.
	 *
	 * Parameters:
	 * - url (string): The request URL.
	 * - data (string): Data to be passed along the request (e. g. form data).
	 * - callback (function): The function to be called when a response is
	 *	returned from the server.
	 * - block (boolean): Whether the site should be blocked.
	 * - id (integer): The id for this image request.
	 *
	 * Returns: Nothing.
	 */ /*
		 * Event handler for load event.
		 */ /*
			 * If we blocked the site on the request,
			 * unblock it on the response.
			 */ /*
			 * Check if callback is registered.
			 */ /*
		 * Event handler for error event.
		 */ /*
			 * If we blocked the site on the request,
			 * unblock it on the response.
			 */ /*
			 * Check if callback is registered.
			 */