Change URL parameters

前端 未结 26 2187
孤独总比滥情好
孤独总比滥情好 2020-11-22 08:40

I have this URL:

site.fwx?position=1&archiveid=5000&columns=5&rows=20&sorting=ModifiedTimeAsc

what I need is to be able to

26条回答
  •  既然无缘
    2020-11-22 08:56

    To answer my own question 4 years later, after having learned a lot. Especially that you shouldn't use jQuery for everything. I've created a simple module that can parse/stringify a query string. This makes it easy to modify the query string.

    You can use query-string as follows:

    // parse the query string into an object
    var q = queryString.parse(location.search);
    // set the `row` property
    q.rows = 10;
    // convert the object to a query string
    // and overwrite the existing query string
    location.search = queryString.stringify(q);
    

提交回复
热议问题