Buon giorno a tutti, prima di scrivere ho dato un'occhiata a precedenti post non trovando la soluzione.
Allora, ho due checkbox in un form, e vorrei inviare i dati ad un pagina.php.
questo è quello che ho:
codice:
//nel form
<input type="checkbox" id="txtIntranet" name="txtIntranet" value="1"/>
<input type="checkbox" id="txtInternet" name="txtInternet" value="1"/>
//nello script jQuery
var txtIntranet= $('input:checkbox[name="txtIntranet"]:checked');
var txtInternet= $('input:checkbox[name="txtInternet"]:checked');
$.ajax({
type: "POST",
url: "FancySlidingForm/file.php",
data:
"txtCodBand=" + txtCodBand +
"&txtIntranet=" + txtIntranet +
"&txtInternet=" + txtInternet,
dataType: "html",
success: function(msg)
{
$("#risultato").html(msg);
alert("Invio dati ok!!");
},
error: function()
{
alert("Chiamata fallita, si prega di riprovare...");
}
//etc etc...
//nella pagina.php dove arrivano i dati
$txtCodBand = trim($_POST["txtCodBand"]);
$txtIntranet = trim($_POST["txtIntranet"]);
$txtInternet = trim($_POST["txtInternet"]);
echo "Intranet:<span>". txtIntranet."</span> - Internet:<span>" . $txtInternet . "</span>" ;
Insomma questo è quanto...
Praticamente in questo modo non mi invia i dati delle checkbox...
Come risolvo?
grazie mille a tutti :|