function Ajax(type, target, item) {
	var xhttp = new XMLHttpRequest();
	xhttp.onreadystatechange = function() {
		if(this.readyState == 4 && this.status == 200) {
			document.getElementById(target).innerHTML = this.responseText;
		}
	};
	xhttp.open(type, item, true);
	xhttp.send();
}

function init(){

	document.getElementById("text").onkeyup = function(){
		//runs converter code
		Ajax("GET", "final", "php/textdecoder.php?t="+document.getElementById("text").value);
	} 
}

document.addEventListener('DOMContentLoaded', init);