Updating existing URL querystring values with jQuery

前端 未结 9 864
逝去的感伤
逝去的感伤 2020-12-01 16:15

Let\'s say I have a url such as:

http://www.example.com/hello.png?w=100&h=100&bg=white

What I\'d like to do is update the values of

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-01 16:29

    Another way (independent of jQuery or other libraries): https://github.com/Mikhus/jsurl

    var u = new Url;
    // or
    var u = new Url('/some/path?foo=baz');
    alert(u);
    u.query.foo = 'bar';
    alert(u);
    

提交回复
热议问题