如果我正确理解您的问题:
您可以使用jQuery和AJAX完成此操作。在第一个示例中,我无需提交整个表单,而仅提交复选框的值:
jQuery("#myCheckbox").click(function() { var $checkbox = jQuery(this); var checkboxData = "checkboxvalue=" + $checkbox.val(); jQuery.ajax({ url: "http://some.url.here", type: "POST", data: checkboxData, cache: false, dataType: "json", success: function(data) { if(data["success"]) { //do some other stuff if you have to //this is based on the assumption that you're sending back //JSON data that has a success property defined } } });});大概您会在服务器端处理一些事情。
如果你真的 不 希望提交一个表单,你可以做同样的事情上面,除非你序列化表单数据:
jQuery("#myCheckbox").click(function() { var formData = jQuery("#formID").serialize(); jQuery.ajax({ url: "http://some.url.here", type: "POST", data: formData, cache: false, dataType: "json", success: function(data) { if(data["success"]) { //do some other stuff if you have to //this is based on the assumption that you're sending back //JSON data that has a success property defined } } });});


