How can I add or update a query string parameter?

后端 未结 27 2890
别那么骄傲
别那么骄傲 2020-11-22 02:35

With javascript how can I add a query string parameter to the url if not present or if it present, update the current value? I am using jquery for my client side development

27条回答
  •  花落未央
    2020-11-22 03:21

    Here is my library to do that: https://github.com/Mikhus/jsurl

    var u = new Url;
    u.query.param='value'; // adds or replaces the param
    alert(u)
    

提交回复
热议问题