do something on selecting a radio button
<p>I want to perform something with the help of jquery when a radio button is selected.</p>

<p>Suppose the page has n number of radio button groups</p>

<pre><code>&lt;input type="radio" name="group1" value="1" onSelect="jquery ajax" /&gt;&lt;br&gt;
&lt;input type="radio" name="group1" value="2" onSelect="jquery ajax" /&gt;&lt;br&gt;


&lt;input type="radio" name="group2" value="1" onSelect="jquery ajax"/&gt;&lt;br&gt;
&lt;input type="radio" name="group2" value="2" onSelect="jquery ajax" /&gt;&lt;br&gt;
</code></pre>

<p>and so on ...</p>

<p>Each onSelect calls the same  js function(suppose, jsForAjaxCall(args)) which initiates the jquery ajax call.</p>

<p>When ever a radio button is selected or deselected I want have a jquery ajax call. I showed it for selection.</p>

<p>1) what is the way to have such a javascript call for unselecting a radio button? is it onUnselect? if yes, will it be compatible with all browsers? i did not find the answer.</p>

<p>2)Suppose user selects one after another radio buttons (one button from a group) and the corresponding ajax calls are made.</p>

<p>But I want the ajax calls to be completed one after another.
Ajax call 1 completes, call2 begins, call2 completes , call3 begins and so on.</p>

<p>But this might not happen in the situation i described because of the asynchronous nature
of ajax. </p>

<p>So I would need to have the succeeding calls stay in the callback function of the preceding jquery ajax calls. I found no way to do it</p>

<p>How can I achieve my goal?</p>

<p>my scripting language is php</p>

<p><strong>EDIT:</strong></p>

<p>suppose the user clicks n radio buttons one after another (one button from a group). For each button selection, a synchronous ajax call is made to make a 2-dimensional session array hold the values of the selected radio buttons so that after the page refresh , those values can be used to retain the selection of the radio buttons. The html radio button code written in the first place should be changed in that case.</p>

<p>My question is:</p>

<p>The user finishes clicking n buttons(i.e n=10) and then s/he refreshes the page. 5 synchronous ajax calls are made and the remaining r yet to be made. Then after page refresh, will the values of the last 5 radio button selections be retained? If not how to retain those in the said situation.</p>
