一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

jquery ajax 没有返回值的解决方法

时间:2011-10-21 编辑:简简单单 来源:一聚教程网

 代码如下 复制代码

//添加async:false.即修改为同步
//
 function vcodeYes() {
        var bol = false;
        $.ajax(
    {
        type: "GET",
        url: "../Ajax/ValidationCode.ashx",
        data: { txtVcode: $('#<%=txtVcode.ClientID%>').val() },
        async: false,
        success: function (data) {
            if (data == "0") {
                $.dialog({ icon: 'warning', follow: document.getElementById('txtVcode'), content: '验证码错误!' }).time(1);
                changeCaptchaImage('imgVerify2', 'txtVcode');
            }
            else {
                bol = true;
            }
        }
    });
        return bol;
    }

//验证没通过是 返回false 否则执行下面函数
 $('.getVodes').click(function () {
       if (vcodeYes()) {
                。。。执行下面。。。
              }

  });

热门栏目