Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <title>Esempio ajax | Your Inspiration Web</title>
- <link href="screen.css" rel="stylesheet" type="text/css" />
- <script type="text/javascript" src="jquery-1.3.2.js"></script> <!-- La versione potrebbe essere differente -->
- <script type="text/javascript">
- $(document).ready(function() {
- $("#input_form").submit(function(){
- var nome = $("#nome").attr('value');
- var cognome = $("#cognome").attr('value');
- var datanascita = $("#datanascita").attr('value');
- $.ajax({
- url: 'result.php',
- type: "POST",
- data: "nome="+nome+"&cognome="+cognome+"&datanascita="+datanascita,
- success: function(data) {
- $("div#result2").html(data);
- }
- });
- return false;
- });
- });
- </script>
- <script type="text/javascript" src="clone-form-td.js"></script>
- </head>
- <body>
- <div id="container">
- <h1>Esempio di utilizzo di Ajax</h1>
- <h2>Inserisci i tuoi dati nei campi sottostanti</h2>
- <h3>Sotto il form visualizzerai la frase senza che vi sia stato un refresh o la richiesta di caricamento di una nuova pagina</h3>
- <form id="input_form" action="?">
- <div id="entry1" class="clonedInput">
- Inserisci il nome:<br />
- <input type="text" name="nome" id="nome"/><br /><br />
- Inserisci il cognome:<br />
- <input type="text" name="cognome" id="cognome"/><br/ ><br/ >
- <label>Data di nascita</label> <br/>
- <input type="text" name="datanascita" placeholder="GG/MM/AAAA" id="datanascita" /> <br />
- </div>
- <input type="button" id="btnAdd" name="aggiungicomp" value="aggiungicomp" /> <br />
- <input type="submit" value="invia">
- <div class="row components"></div>
- </form><br /><br />
- <div id="result2"></div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement