Ciao a tutti.
Sto cominciando a studiare jquery ed ho un po' di difficoltà...
Questo codice funziona perfettamente:
Ma io vorrei inviare i dati di tutti gli input senza sapere quali sono, ovvero non voglio fare manualmente un elenco... Ho provato così ma non funziona come devo fare??codice:<script> /* attach a submit handler to the form */ $("#SaveForm").submit(function(event) { /* stop form from submitting normally */ event.preventDefault(); /* get some values from elements on the page: */ var $form = $( this ), term = $form.find( 'input[name="nome"]' ).val(), url = $form.attr( 'action' ); /* Send the data using post and put the results in a div */ $.post( url, { nome: term }, function( data ) { var datiricevuti = $( data ).find( "#contenuto" ); var datiricevuti = $( data ); $( "#risultato" ).empty().append( datiricevuti ); } ); $("#risultato").animate({opacity: "1"}, 1500) }); </script>
codice:<script> /* attach a submit handler to the form */ $("#SaveForm").submit(function(event) { /* stop form from submitting normally */ event.preventDefault(); /* get some values from elements on the page: */ var $form = $( this ), term = $form.find( 'input[name="nome"]' ).val(), url = $form.attr( 'action' ); datastr = $(form).serialize(); /* Send the data using post and put the results in a div */ $.post( url, { data: datastr }, function( data ) { var datiricevuti = $( data ).find( "#contenuto" ); var datiricevuti = $( data ); $( "#risultato" ).empty().append( datiricevuti ); } ); $("#risultato").animate({opacity: "1"}, 1500) }); </script>

Rispondi quotando
