Hi,
I've mockup this simple method which would use in real product. But unfortunately, i can't make the script working.
Code:
<!DOCTYPE html>
<html>
	<head>
		<title>Pass Script</title>
	</head>
	<body>
		<button id=button>Get</button>
		<div id='log'></div>
		<script>
			var log = function(msg) {document.getElementById('log').innerHTML = msg + "<br/>";};
			var button = document.getElementById('button');
			button.addEventListener('click', function(e) {
				var xhr = new XMLHttpRequest();
				xhr.open('GET', 'test.php', true);
				xhr.send();
				xhr.onreadystatechange = function () {
					if (xhr.readyState === 4) {
						if (xhr.responseText === 'undefined') {
							return;
						} else {
							log(xhr.responseText);
						}
					}
				};
			});
		</script>
	</body>
</html>
And the test.php:
Code:
<input type=text name=data />
<script>
	console.log('You\'ve got data');
</script>
How do I make the script on the test.php file working?

Thank you,