<?
header("Content-type: text/html; charset=windows-1251"); ?>
<html>
<head>
<style>
#results {
color: forestgreen;
}
</style>
<script type="text/javascript" src="../js/jquery.js"></script>
</head>
<body>
<script type="text/javascript" language="javascript">
function call() {
var msg = $('#formx').serialize();
$.ajax({
type: 'POST',
url: 'formAjax.php',
data: msg,
success: function(data) {
$('#results').html(data);
},
error: function(xhr, str){
alert('Возникла ошибка: ' + xhr.responseCode);
}
});
}
</script>
<form method="POST" id="formx" action="javascript:void(null);" onchange="call()">
<input id="name" name="name" value="" type="text">
</form>
<div id="results"></div>
</body>
</html>
PD8KaGVhZGVyKCJDb250ZW50LXR5cGU6IHRleHQvaHRtbDsgY2hhcnNldD13aW5kb3dzLTEyNTEiKTsKPz4KPGh0bWw+CjxoZWFkPgoKICAgIDxzdHlsZT4KICAgICAgICAjcmVzdWx0cyB7CiAgICAgICAgICAgIGNvbG9yOiBmb3Jlc3RncmVlbjsKICAgICAgICB9CiAgICA8L3N0eWxlPgogICAgPHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiIHNyYz0iLi4vanMvanF1ZXJ5LmpzIj48L3NjcmlwdD4KCjwvaGVhZD4KCjxib2R5Pgo8c2NyaXB0IHR5cGU9InRleHQvamF2YXNjcmlwdCIgbGFuZ3VhZ2U9ImphdmFzY3JpcHQiPgogICAgZnVuY3Rpb24gY2FsbCgpIHsKICAgICAgICB2YXIgbXNnICAgPSAkKCcjZm9ybXgnKS5zZXJpYWxpemUoKTsKICAgICAgICAkLmFqYXgoewogICAgICAgICAgICB0eXBlOiAnUE9TVCcsCiAgICAgICAgICAgIHVybDogJ2Zvcm1BamF4LnBocCcsCiAgICAgICAgICAgIGRhdGE6IG1zZywKICAgICAgICAgICAgc3VjY2VzczogZnVuY3Rpb24oZGF0YSkgewogICAgICAgICAgICAgICAgJCgnI3Jlc3VsdHMnKS5odG1sKGRhdGEpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBlcnJvcjogIGZ1bmN0aW9uKHhociw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