WebmasterGeeks
09-27-2006, 05:39 AM
I have a form on my site which when submitted, sends the result to a javascript function, which then properly handles the data. This allows the form to be submitted through javascript without the user leaving the page. My problem is that whether I use the "get" or "post" method, I can't figure out how to submit the data properly.
Here's an example of how this should work:
If the user selects "Selection 2" from the dropdown and clicks submit, then the action should be "javascript:submittopage('submitform.php?Option=2', '1');""
What I can't figure out is how to append the "?Option=2" to the end of the submitform.php URL. I've been trying to figure this out for quite some time, but I'm stumped. Is there anyone here who's more proficient in javascript and who knows how to make this work?
Thanks!
Here's my form code:
<form id="form1" name="form1" method="get" action="javascript:submittopage('submitform.php', '1');">
<label>
<select name="Option">
<option value="" selected="selected">Select An Option</option>
<option value="1">Selection 1</option>
<option value="2">Selection 2</option>
<option value="3">Selection 3</option>
<option value="4">Selection 4</option>
<option value="5">Selection 5</option>
</select>
</label>
<label>
<input type="submit" name="Submit" value="Submit">
</label>
</form>
Here's an example of how this should work:
If the user selects "Selection 2" from the dropdown and clicks submit, then the action should be "javascript:submittopage('submitform.php?Option=2', '1');""
What I can't figure out is how to append the "?Option=2" to the end of the submitform.php URL. I've been trying to figure this out for quite some time, but I'm stumped. Is there anyone here who's more proficient in javascript and who knows how to make this work?
Thanks!
Here's my form code:
<form id="form1" name="form1" method="get" action="javascript:submittopage('submitform.php', '1');">
<label>
<select name="Option">
<option value="" selected="selected">Select An Option</option>
<option value="1">Selection 1</option>
<option value="2">Selection 2</option>
<option value="3">Selection 3</option>
<option value="4">Selection 4</option>
<option value="5">Selection 5</option>
</select>
</label>
<label>
<input type="submit" name="Submit" value="Submit">
</label>
</form>