前台代码:
<input id="btnSubmit" type="button" class="form-control btn btn-success" value="注册"> <script type="text/javascript">
$('#btnSubmit').on('click', function(){
$.ajax({
url:"{:U('Sign/signup2')}",
data:{
id:123123123122
},
type:"POST",
dataType:"json",
success:function(JSON){
// debugger;
},
error:function(xhr,status,errorThrown){
// debugger;
},
complete:function(xhr,status){
// alert('The request is complated');
},
beforesend:function(){
},
cache:false,//true
async:true
});//ajax end here
});//btnSubmit click end here
</script>这样能提交吗?url:"{:U('Sign/signup2')}", 这个写错了,要写控制器名/方法名。
最佳答案