How to add a parameter to the URL?

后端 未结 9 1002
遇见更好的自我
遇见更好的自我 2020-11-30 06:37

My current URL is: http://something.com/mobiles.php?brand=samsung

Now when a user clicks on a minimum price filter (say 300), I want my URL to become

9条回答
  •  自闭症患者
    2020-11-30 07:25

    use var urlString = window.location to get the url

    check if the url already contains a '?' with urlString.indexOf('?'), -1 means it doesnt exist.

    set window.location to redirect

    this is like 101 of javascript. try some search engines!

提交回复
热议问题