Ciao ragazzi,
passo ad una pagina php in ajax due valori, un textbox e un radio. Il textbonx viene recuperato senza problemi, il radio invece mi esce sempre undefined...come posso passare correttamente anche il valore selezionato dell'input radio?
questa è la pagina:
codice:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Documento senza titolo</title> <script src="../js/jquery.js"></script> <script type="text/javascript"> function Register(a, b) { $.ajax({ type: "POST", url: "script.php", data: "nome="+a+"&sesso="+b, timeout: 3000, error: function() { alert("Errore: dati non salvati"); return true; }, success: function(msg){ $("#result").html(msg).hide() .fadeIn(1000, function() { }) } }); } </script> </head> <body> <form id="form1" name="form1"> <input type="text" name="nome" id="nome" /> </p> <input name="sesso" type="radio" id="radio" value="M" checked="checked" /> M <input type="radio" name="sesso" id="radio2" value="F" /> F</p> <div id="result"></div> </p> <input type="button" name="button" id="button" value="Invia" onclick="Register(nome.value, sesso.value)" /> </p> </form> </body> </html>

Rispondi quotando