fork download
  1. <?
  2. header("Content-type: text/html; charset=windows-1251");
  3. ?>
  4. <html>
  5. <head>
  6.  
  7. <style>
  8. #results {
  9. color: forestgreen;
  10. }
  11. </style>
  12. <script type="text/javascript" src="../js/jquery.js"></script>
  13.  
  14. </head>
  15.  
  16. <body>
  17. <script type="text/javascript" language="javascript">
  18. function call() {
  19. var msg = $('#formx').serialize();
  20. $.ajax({
  21. type: 'POST',
  22. url: 'formAjax.php',
  23. data: msg,
  24. success: function(data) {
  25. $('#results').html(data);
  26. },
  27. error: function(xhr, str){
  28. alert('Возникла ошибка: ' + xhr.responseCode);
  29. }
  30. });
  31.  
  32. }
  33. </script>
  34. <form method="POST" id="formx" action="javascript:void(null);" onchange="call()">
  35.  
  36. <input id="name" name="name" value="" type="text">
  37.  
  38.  
  39. </form>
  40.  
  41.  
  42. <div id="results"></div>
  43. </body>
  44. </html>
Success #stdin #stdout 0.02s 24448KB
stdin
Standard input is empty
stdout
<?
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>