Do you have an idea how to send the name of my radio button to
myAjaxPostrequest.send(parameters);
may be such parameters:
var answername=document.getElementById('option1').name;
var parameters=answername;
? this code is for using ajax to submit the form
and my php page needs the name of the click that the radio camera clicks on
I tried this code and it works the way I want, except to insert into the database. This means that the parameters are problems.
what I want to insert is the number located between the brakes of the name of the radio object.
I could do this when I submit the form without AJAX, but now I cannot submit the name of the radio
Any clue on what I can send as a parameter to a function myAjaxPostrequest.send(parameters);?
<form id="Question1" method="post">
<br />
<P> The sky color is..
</P><img border="0" src="images/wonder.png" width="94" height="134"/><br /><br /><br />
<input type="radio" id="option1" name="answer[1]" value="correct!" onclick="submitFormWithAjax();"/> blue
<br />
<input type="radio" id="option1" name="answer[1]" value="false!" onclick="submitFormWithAjax();"/> red
<br />
<input type="radio" id="option1" name="answer[1]" value="false!" onclick="submitFormWithAjax();"/> green
<br />
<input type="radio" id="option1" name="answer[1]" value="false!" onclick="submitFormWithAjax();"/> white
</form>
source
share