开发者

$.JQuery.Query removing zeros from my numeric querystring value

I am using JQuery Querystring plugin for getting the Querystrings.

I have below code:

if ($.query.get("mode"))
        {
            //alert("mode");
            var newUrl;
            var t1 = ($.query);            
            newUrl = $.query.REMOVE("mode");    
            $.query.toString();               
            currentPageLink = reloadURL.split("?")[0] + $.query.set("mode", "ssl");                       
        }

The problem is that when I am using $.query.set("mode", "ssl") its removing my numeric 00 from 001 values, I mean if any of mine querystring is numeric for example "....?accountno=001" after doing $.query.set it is changing it into ?accountno=1,

Please 开发者_高级运维suggest!!


$.query seems to typecast your accountno as an integer instead of a string (which would preserve the two leading zeroes).

There appears to be a bug in the regex used to determine whether a parameter is a int or not. Currently, even strings leading zeroes (and only number characters) are typecasted. They shouldn't be.

In line 89 of the latest query plugin, the regex, /^[+-]?[0-9]+$/, can be rewritten and that should do it. I was going to suggest /^[+-]?[1-9][0-9]*$/, but this regex misses the case of "0".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜