Issue with processing form i ajax with radio buttons
<p>I have this script which makes possible the insertion of some data using ajax and php.</p>

<p>Now , all works fine, except the radio buttons (the select options work fine as well) , and it takes the first value of the radio buttons..</p>

<p>Why is this happening?
Here is the code:</p>

<pre><code>&lt;div id="formfields" &gt;&lt;label&gt;Tipologia Pdv: &lt;/label&gt;
&lt;input type="radio" name="tipologia_pdv" id="tipologia_pdv" value="Iper" style="width:40px;" /&gt;&lt;span &gt; Iper&lt;/span&gt;
&lt;input type="radio" name="tipologia_pdv" id="tipologia_pdv"
value="Super" style="width:40px;" /&gt;&lt;span &gt; Super&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div id="formfields" &gt;&lt;label&gt;Richiesta Ccnl: &lt;/label&gt;
&lt;input type="radio" name="richiesta_ccnl" id="richiesta_ccnl" value="Si" style="width:40px;"/&gt;&lt;span&gt; Si&lt;/span&gt;
&lt;input type="radio" name="richiesta_ccnl" id="richiesta_ccnl"
value="No" style="width:40px;"/&gt;&lt;span&gt; No&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt; 
</code></pre>

<p>The javascript:</p>

<pre><code>// Fetch data from input fields.
var js_tipologia_pdv = $("#tipologia_pdv").val();
var js_richiesta_ccnl = $("#richiesta_ccnl").val();

//let's put all data together
var myData = 'postTipologia_pdv='+ js_tipologia_pdv + '&amp;postRichiesta_ccnl='+ js_richiesta_ccnl + '&amp;postDistretto_pdv=' + js_distretto_pdv + '&amp;postCoopva_pdv=' + js_coopva_pdv + '&amp;postNome_pdv=' + js_nome_pdv;
</code></pre>

<p>In php they go something like this:</p>

<pre><code>$postTipologia_pdv      = filter_var($_POST["postTipologia_pdv"], FILTER_SANITIZE_STRING); 
$postRichiesta_ccnl     = filter_var($_POST["postRichiesta_ccnl"], FILTER_SANITIZE_STRING); 
</code></pre>
