Posting a form using Ajax
- by hopes
Hi everyone,
do u have an idea of how to send my radio button name for
myAjaxPostrequest.send(parameters);
can parameters be like this:
var answername=document.getElementById('option1').name;
var parameters=answername;
? this code is for using ajax to post a form
and my php page needs the name of the radiobutton clicked
I tried this code and it works as I want except for inserting in the database. It means parameters is the problem
what I want to insert is the number located between brakects of the radiobutton name.
I could do it when I post form without Ajax but now I can't send the name of the radiobutton
any clue about what I can send as parameter for 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
<br />
<br /> </Form>