<form id="form2">
<input type="text" name="admin_name" id="admin_name" placeholder="Name"></br>
<input type="password" name="password" id="password" placeholder="Password"></br>
<input type="text" name="verify" id="verify" placeholder=""></br>
<img src="{:captcha_src()}" alt="captcha" onclick="this.src=this.src+'?'" /></br>
<input id="login" type="submit" id="login" name="login" value="登录">
<!-- <button type="button" onclick="ajaxPost()" name="button">登录</button> -->
</form>
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<!-- <script type="text/javascript" src="/static/js/jquery-1.10.2.min.js"></script> -->
<script>
$(function(){
$('#login').on('click', function(){
$.ajax({
type: 'POST',
url: "{:url('admin/check')}",
data: $('form2').serialize(),
dataType: 'json',
success: function(data){
if (data.status == 1) {
alert(data.message);
window.location.href="{:url('index/indexafter')}";
} else {
alert(data.message);
}
}
});
})
})
</script>我用 $data = $request -> param();获取数据,试了打印数据,数据完全没有提交上去,请问我写错什么了 最佳答案