当前位置: 代码迷 >> JavaScript >> JQuery Ajax data.d含意
  详细解决方案

JQuery Ajax data.d含意

热度:701   发布时间:2013-12-13 00:50:19.0
JQuery Ajax data.d含义

$.ajax({
            url: 'EmailExist.action',
            data: '{email:"' + email + '"}',
            type: 'post',
            dataType: 'json',
            contentType: 'application/json; charset=utf8',
            cache: false,
            success: function(data) {
                if (data.d) {
                    setTimeout(function() {
                        //$('#ctl00_holderLeft_txt_email').val('');
                        $('#tip_email').removeClass('validation-valid');
                        $('#tip_email').addClass('validation-error');
                        $('#tip_email').html('邮箱<strong>"' + email + '</strong>"已存在,请使用其他邮箱');
                    }, 10);
                }
                //else
                    //$('#tip_email').html("邮箱输入成功");
            },
            error: function(xhr) {
                $('#tip_email').html(xhr.responseText);
            }
        });


Ajax中有个data.d,请问下各位大牛们这个data.d是个什么含义?
Ajax

------解决方案--------------------
这个d是看你ajax访问的url响应中有d就有没有就没有
比如ajax返回  {'d':1,'msg':'exists'}
data.d的值就为1
贴这段代码主要是判断邮箱是否已存在
存在返回  {'d':1}
------解决方案--------------------
本帖最后由 showbo 于 2013-11-29 17:18:10 编辑
d是asp.net webservice返回的json对象的属性(包含你return 返回的内容),其他内容都放在d属性里面
  相关解决方案