Two-point problem of jQuery.query.js taking parameters

Source: Internet
Author: User

Recently in the project using JQuery.query.js this plug-in to the page URL transfer value, encountered the following two points problem:

1. The value taken when there is a space in the parameter is replaced by a plus sign: +

2. When the value of a key of a parameter does not exist, the value obtained is NOT null/null but true.

Found a solution on the Internet, you can refer to (whether there are other side effects of the temporary not experimental)

1. Space Change Plus +

Locate the following code in the JQuery.query.js file

1234567 toString: function() {           vari = 0, queryString = [], chunks = [], self = this;           varencode = function(str) {               str = str + "";               //if ($spaces) str = str.replace(/ /g, "+");               returnencodeURIComponent(str);    };

Comment out if ($spaces) str = str.replace (//g, "+"); That line can

2. The case that value is empty

1234567891011 get: function(key){    vartarget = this.GET(key);    if(typeof(target) == ‘boolean‘)        return‘‘;    if(is(target, Object))        return jQuery.extend(true, {}, target);    elseif(is(target, Array))        returntarget.slice(0);    returntarget;},
1 <br>
1 <div>加入  </div><p>if(typeof (target) == ‘boolean‘)                     </p><p>return‘‘; 即可  </p>

Two-point problem of jQuery.query.js taking parameters

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.