如何使用下面的内容发送到php页面,mysql中的每个复选框的值要么插入到新行中,要么更新现有列
<script language="javascript" type="text/javascript">// <![CDATA[
var $n = jQuery.noConflict(); //Jquery no conflict
$n("#btnsubmit").click(function() {
var allChkbox=$n('input[name=cats[]]');
jQuery.each(allChkbox, function(i, singlecheckbox) {
alert(singlecheckbox.value+" is "+ singlecheckbox.value);
});
});
// ]]></script>
var $n = jQuery.noConflict(); //Jquery no conflict
$n("#btnsubmit").click(function() {
var allChkbox=$n('input[name=cats[]]');
var data = [];
jQuery.each(allChkbox, function(i, singlecheckbox) {
data[singlecheckbox.value] = singlecheckbox.value; // this line is strange, the index seems not be singlecheckbox.value
// alert(singlecheckbox.value+" is "+ singlecheckbox.value);
});
$.ajax({type:"GET", url: "test.php", data: data,
success:function(records){}, error: function(request, status, err){}});
});
test.php将通过get接收请求