简体   繁体   English

Internet Explorer 7 jQuery验证

[英]Internet Explorer 7 jQuery Validate

can someone please suggest a better means to accomplish what i'm doing below. 有人可以建议一种更好的方法来完成我在下面做的事情。 The commented out return works in all browsers besides after IE7. 注释掉的return不仅适用于IE7,而且还适用于所有浏览器。 I know this is totally ghetto, but this is the only way I've gotten it to work because IE7 can't parse json that I know of. 我知道这完全是贫民窟,但这是我使用它的唯一方法,因为IE7无法解析我所知道的json。 It seems like this is just one thing piling up on top of the other when I use webforms and jquery Validation. 当我使用webforms和jquery Validation时,这似乎只是一件事情。 I can't get my webservice to reply if the values are in the query string so I have to add rules manually. 如果值在查询字符串中,我无法让我的网络服务回复,因此我必须手动添加规则。 ie /webservices/ipmws.asmx/SiteValid?tbSiteName=WHATEVER.... If that would work perhaps all this wouldn't be required? 即/webservices/ipmws.asmx/SiteValid?tbSiteName=WHATEVER ....如果可以,也许不需要所有这些?

Thanks in advance. 提前致谢。

$('#form2').validate();
    $("#tbSiteName").rules("add", {
        remote: function () {
            var r = {
                url: "/webservices/ipmws.asmx/SiteValid",
                type: "POST",
                data: "{'tbSiteName': '" + $("#tbSiteName").val() + "'}",
                dataType: "json",
                contentType: "application/json; charset=utf-8",
                dataFilter: function (data) {
                    var str = data.split(':');
                    return str[1].substring(0, str[1].length -1)
                    //return (JSON.parse(data)).d;
                }
            }
            return r;
        },
        messages: {
            remote: "The site code is either not present or invalid."
        }
    });

Have you tried jQuery's $.parseJSON() method? 您是否尝试过jQuery的$ .parseJSON()方法? http://api.jquery.com/jQuery.parseJSON/ http://api.jquery.com/jQuery.parseJSON/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM