【已解决】前台普通的button怎么提交数据到后台PHP?

浏览:4389 发布日期:2016/03/06 分类:求助交流 关键字: ajax
我在普通button上添加了click事件,可是,点了button后,整个页面没反应,请问,是哪里有错?

前台代码:<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')}", 这个写错了,要写控制器名/方法名。
最佳答案
评论() 相关
后面还有条评论,点击查看>>