File: index.php

Recommend this page to a friend!
  Classes of Everton da Rosa   JS Submit Form Data   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example of use
Class: JS Submit Form Data
Submit forms using AJAX requests
Author: By
Last change:
Date: 9 years ago
Size: 1,543 bytes
 

Contents

Class file image Download
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>FormDataSender :: envie dados de formulário com AJAX, inclusive arquivos.</title> <script type="text/javascript" src="formdatasender.js"></script> <script type="text/javascript"> window.addEventListener('load', function(evt){ document.getElementById('test').addEventListener('submit', function(evt){ evt.preventDefault(); var sender = new FormDataSender(document.getElementById('test'), document.getElementById('progress')); }); }); </script> </head> <body> <form id="test" action="process.php" method="post" enctype="multipart/form-data"> <div> <progress id="progress" value="0" min="0" max="100"></progress> </div> <div> <label>Text field</label> <input type="text" name="textfield" value="Sample text"> </div> <div> <label>Number field</label> <input type="number" name="numberfield" value="10"> </div> <div> <label>File field</label> <input type="file" name="filefield"> </div> <div> <button type="submit">Send</button> <button type="reset">Clear</button> </div> </form> </body> </html>