How to remove/unset some get parameters and refresh with jQuery

ggzone

I want to remove some parameters of my url www.domain.com?a=1&b=2&c=3

For example I have this code already from stackoverflow here which works fine:

return location.href=location.href.replace(/&?a=([^&]$|[^&]*)/i, "");

As I am not familiar with regex, how is it possible to add another parameter to this line? Right now it only removes the "a" parameter. I also want the "b" parameter to be removed too.

Edit: Ofcorse I am not using "a" and "b" as a parameter. How does it work with parameters like "crop-image" and "subscription" so the domain looks like: www.domain.com?crop-image=1&subscription=1&keep=me

Syon

Replace [ab] with a set of capture groups of the parameters you want to remove.

location.href=location.href.replace(/&?((crop-image)|(subscription))=([^&]$|[^&]*)/gi, "");

Whatever is contained inside each group will match exactly against a full parameter name. You can or (|) together as many groups as you need.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Jquery Datatable - how to refresh the table with some static column (not from backend) by ajax

분류에서Dev

jQuery How to refresh appended div's characteristics?

분류에서Dev

How to refresh a part of a page using jquery

분류에서Dev

How to make jQuery script refresh itself?

분류에서Dev

How to get DB2 MQT last refresh time

분류에서Dev

How to get name between some string?

분류에서Dev

flask - how to get parameters from a JSON GET request

분류에서Dev

how to get div content by jquery?

분류에서Dev

How to get jQuery to work with Underscore?

분류에서Dev

How to reset initialized jQuery plugin variables on some other event?

분류에서Dev

Selenium/Java How can I pass desired capabilities to FireFoxDriver, when its already taking in some other parameters?

분류에서Dev

How to get some informations of a contact by using cursor loader?

분류에서Dev

how can I get a some values in strings in bash script

분류에서Dev

How can I get some particular link form the links collection

분류에서Dev

How to get routing parameters of simple single page app?

분류에서Dev

How does Chef recipe get/retrieve parameters from databag?

분류에서Dev

How do I create pretty url from the GET parameters in Django?

분류에서Dev

How to refresh an UIImage in an UITableViewCell?

분류에서Dev

How to Set & Get ID in JQuery Autocomplete

분류에서Dev

jQuery if statment with hover, How to get this working

분류에서Dev

How to get width from animated div in jQuery

분류에서Dev

how to Get an id of DOM elements using JQuery

분류에서Dev

how to get dropdownlist option's Quantity in jquery

분류에서Dev

TableSorter jQuery -- How to get values after filtering?

분류에서Dev

How to get next row column by javascript or jquery

분류에서Dev

How to get the selected element in jQuery event delegation?

분류에서Dev

How to get variables in an anonymous function in jQuery?

분류에서Dev

How to update a get parameter in a url with jquery

분류에서Dev

URL Rewrite GET parameters

Related 관련 기사

  1. 1

    Jquery Datatable - how to refresh the table with some static column (not from backend) by ajax

  2. 2

    jQuery How to refresh appended div's characteristics?

  3. 3

    How to refresh a part of a page using jquery

  4. 4

    How to make jQuery script refresh itself?

  5. 5

    How to get DB2 MQT last refresh time

  6. 6

    How to get name between some string?

  7. 7

    flask - how to get parameters from a JSON GET request

  8. 8

    how to get div content by jquery?

  9. 9

    How to get jQuery to work with Underscore?

  10. 10

    How to reset initialized jQuery plugin variables on some other event?

  11. 11

    Selenium/Java How can I pass desired capabilities to FireFoxDriver, when its already taking in some other parameters?

  12. 12

    How to get some informations of a contact by using cursor loader?

  13. 13

    how can I get a some values in strings in bash script

  14. 14

    How can I get some particular link form the links collection

  15. 15

    How to get routing parameters of simple single page app?

  16. 16

    How does Chef recipe get/retrieve parameters from databag?

  17. 17

    How do I create pretty url from the GET parameters in Django?

  18. 18

    How to refresh an UIImage in an UITableViewCell?

  19. 19

    How to Set & Get ID in JQuery Autocomplete

  20. 20

    jQuery if statment with hover, How to get this working

  21. 21

    How to get width from animated div in jQuery

  22. 22

    how to Get an id of DOM elements using JQuery

  23. 23

    how to get dropdownlist option's Quantity in jquery

  24. 24

    TableSorter jQuery -- How to get values after filtering?

  25. 25

    How to get next row column by javascript or jquery

  26. 26

    How to get the selected element in jQuery event delegation?

  27. 27

    How to get variables in an anonymous function in jQuery?

  28. 28

    How to update a get parameter in a url with jquery

  29. 29

    URL Rewrite GET parameters

뜨겁다태그

보관