这是我们的代码
<div class="col-2">
<div class="input-group">
<label class="label">Name</label>
<input id="name" class="input--style-4" type="text">
</div>
和JS
var btn = document.getElementById("register");
var email = document.getElementById("email");
var pw = document.getElementById("pw");
var date = document.getElementById("date").value;
var gender = document.getElementById("gender");
var name = document.getElementById("name");
var number = document.getElementById("number");
btn.onclick=function(){
if(gender.checked) gender="m";
else gender="f";
$.ajax({
url: 'register.php',
type: 'POST',
data: {
email: email.value,
pw: pw.value,
date: date,
gender: gender,
name: name.value,
number: number.value
},
继续发送 null 作为名称值。
有什么问题?
holdtom
相关分类