直接上代码,主要是获取checkbox值的方法:将其放到数组中,然后连接成字符串

var selectedItems = new Array();
$("input[@name='itemSelect[]']:checked").each(function() {selectedItems.push($(this).val());});

if (selectedItems .length == 0)
    alert("Please select item(s) to delete.");
else
    $.ajax({
	type: "POST",
	url: "/ajax_do_something.php",
	data: "items=" + selectedItems.join('|'),
	dataType: "text",
	success: function (request) {
	    document.location.reload();
	  },
	error: function(request,error){
	    alert('Error deleting item(s), try again later.');
	  }
	}
    )
来自yaronspace.cn  本文链接:http://yaronspace.cn/blog/archives/708