ajax Post请求方法
; var common_index_ops = { init:function(){ this.eventBind(); }, eventBind:function(){ $(".save").click(function(){ var btn_target = $(this); if(btn_target.hasClass("disabled")){ alert("正在处理,请不要重复提交~"); return; } var nickname_target = $(".wrap_account_set input[name=nickname]"); var nickname = nickname_target.val(); if(nickname.length < 1){ alert("请输入规范的昵称"); return; } btn_target.addClass("disabled"); var data = { nickname:nickname }; $.ajax({ url:"", type:"POST", data:data, dataType:"json", success:function (res){ btn_target.removeClass("disabled"); if(res.code == 1){ }; }, error:function (res){ btn_target.removeClass("disabled"); } }); }); }, }; $(document).ready(function(){ common_index_ops.init(); });