snake_eyes
04-28-2007, 09:16 AM
Hello, Dear Guys how to pass variables into AJAX request,
I have this div in the PHP page:
<div id="display_poll"></div>
and this is the AJAX_common.php code:
<table width="125" border="0" cellspacing="0" cellpadding="0">
<form method="post" action="ajax_common.php">
<tr>
<td class="cell3">question</td>
</tr>
<tr>
<td class="cell4"><input type="radio" name="option_id" value="1">option 1</td>
</tr> <tr>
<td class="cell4"><input type="radio" name="option_id" value="2">option 2</td>
</tr> <tr>
<td class="cell4"><input type="radio" name="option_id" value="3">option 3</td>
</tr> <tr>
<td class="cell4">
<input type="hidden" name="action" value="vote">
<input type="hidden" name="poll_ident" value="22">
<input type="submit" class="button" value="vote">
<br>
<span class='click_span' onclick="MakeRequest('ajax_common.php?action=results&poll_ident=22', 'display_poll')">results</span>
</td>
</tr>
</form>
</table>
when I select an option then submit the page it will reload again, is there a way to switch automatic the div and get the poll result instead of poll main form
regards heaps
I have this div in the PHP page:
<div id="display_poll"></div>
and this is the AJAX_common.php code:
<table width="125" border="0" cellspacing="0" cellpadding="0">
<form method="post" action="ajax_common.php">
<tr>
<td class="cell3">question</td>
</tr>
<tr>
<td class="cell4"><input type="radio" name="option_id" value="1">option 1</td>
</tr> <tr>
<td class="cell4"><input type="radio" name="option_id" value="2">option 2</td>
</tr> <tr>
<td class="cell4"><input type="radio" name="option_id" value="3">option 3</td>
</tr> <tr>
<td class="cell4">
<input type="hidden" name="action" value="vote">
<input type="hidden" name="poll_ident" value="22">
<input type="submit" class="button" value="vote">
<br>
<span class='click_span' onclick="MakeRequest('ajax_common.php?action=results&poll_ident=22', 'display_poll')">results</span>
</td>
</tr>
</form>
</table>
when I select an option then submit the page it will reload again, is there a way to switch automatic the div and get the poll result instead of poll main form
regards heaps