【发布时间】:2012-01-31 19:59:25
【问题描述】:
HTML:
<form id="dbview" method="post" action="core/process.php">
....
<p style='text-align:center;'>
<input id='delete' type='submit' name='process' value='Delete selected'/>
<input id='print' type='submit' name='process' value='Print barcodes'/>
</p>
</form>
对于Delete selected,所有工作都执行 process.php 。但是对于Print barcodes,我想通过ajax 将所有选定的复选框值作为$_POST 发送到下面的php 文件。
PHP:
<?php
echo '<table>';
for ($i = 1; $i <= 13; $i++) {
echo '<tr>';
for ($a = 1; $a <= 5; $a++) {
echo '<td>';
foreach ($_POST['checkbox'] as $id) {
echo '<img src="bc.php?id=' . $id . '"/>';
}
echo '</td>';
}
echo '</tr>';
}
echo '</table>';
?>
Javascript:
$('#print').click( function(e) {
if($('.checkbox:checked').length<1){
$.notifyBar({
cls: "error",
html: 'At least 1 checkbox must be checked.',
delay: 5000
});
e.preventDefault();
}
//SEND AJAX POST HERE
});
请帮我发送所有选定的值并在新窗口中输出返回的页面。
【问题讨论】:
标签: php javascript jquery ajax window