Advertisement
Guest User

Untitled

a guest
Oct 10th, 2015
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <script type="text/javascript" src="/js/jquery-1.11.3.js"></script>
  6. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
  7.  
  8. </head>
  9. <body>
  10.  
  11. <script>
  12.  
  13.  
  14. window.onload = function() {
  15. var x = document.getElementById('one');
  16. var y = document.getElementById('two');
  17. var z = document.getElementById('knopka');
  18. x.style.background = 'red';
  19. y.style.background = 'green';
  20.  
  21. $('#knopka').click(function(){var x = $('one').val(); var y = $('two').val(); $.ajax({
  22. type: "POST",
  23. url: "jqueryphp.php",
  24. data: {one:one, two:two},
  25. success: function(data){alert(data);}
  26. })})
  27.  
  28. };
  29. </script>
  30.  
  31. <form action="" method="post">
  32. Первый: <input type="text" name="one" id="one"><br><br>
  33. Второй: <input type="text" name="two" id="two"><br><br>
  34. <input type="submit" id="knopka">
  35. </form>
  36.  
  37. <?php
  38.  
  39. $a = $_POST['one'];
  40. $b = $_POST['two'];
  41. echo $a + $b;
  42.  
  43. ?>
  44.  
  45. </body>
  46. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement