ajax如何同步请求做到验证

2016-12-15 18:36:44来源:CSDN作者:ruini39337人点击

function issetsame(){
                var name=$("#name").val();
                var ret = 0;
                $.ajax({
                    async : false,//改成同步
                    url:"1.php",
                    data:{'name_a':name},
                    dataType:"json",
                    type:"POST",
                    success:function(inset_same){
                        if (inset_same['a'] == 0) {
                            ret = 1;
                        }else{
                            ret = 2;
                        }
                    }
                });
                return ret;//返回到方法(划重点

            }




最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台