Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>PHP Ajax</title>
- <meta charset="utf-8">
- </head>
- <body>
- <form id="form" action="process.php" method="POST">
- <input type="text" name="name" placeholder="Name"><br>
- <input type="text" name="email" placeholder="Email"><br>
- <textarea name='message'></textarea><br>
- <button type="submit">Senden</button>
- </form>
- <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
- <script>
- $(document).ready(function(){
- $('#form').submit(function(e){
- //console.log('Submitted');
- $.ajax({
- type: "POST",
- url: "process.php",
- data: $("#form").serialize(),
- success: function(data){
- console.log(data)
- }
- })
- e.preventDefault();
- })
- })
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement