-6
我想通过jQuery ajax检查复选框时提交表单。什么是最好的方法来做到这一点?复选框表单通过jquery-Ajax提交
我想通过jQuery ajax检查复选框时提交表单。什么是最好的方法来做到这一点?复选框表单通过jquery-Ajax提交
这不是用户友好的,但你可以通过这个
$('#checkbox').change(function() {
// Is checkbox checked?
if ($(this).is(':checked')) {
// Send parent form data via post
$.post('submission-url.html', $(this).closest('form').serialize(), function(data) {
// process response
});
}
});
做到这一点,您可以通过$(this).closest('form').attr('action')
而不是“提交-url.html”从form
元素得到action
属性
** [你有什么尝试?](http://whathaveyoutried.com)** – 2013-02-26 18:38:02