bootstrap ajax form submit,提交时的bootstrap复选框值(bootstrap checkbox values on submit)

贾成天
2023-12-01

I'm using bootstrap in an PHP web application. I use the issues to generate a form, and include some checkbox's in the form, like this

//PHP Code To Generate the CheckBox

echo '';

Then, I manange the submit of the form manually, with ajax, and do something like this:

$.ajax({

type: 'post',

data: { $("#myCheckBox").val()},

url: 'someurl.php',

success: function () { alert('Something to do')}

});

The problem is when I recover the content of $_POST variables on PHP. The POST variable of the checkbox always contains 'on' as value.

Any help to get the value of this CheckBox using this way?

Thanks!.

 类似资料: