Top menu

Add param in URL

In the function below, I will show you how to add a parameter in URL by treating all possible cases :

  1. first check whether the parameter is already defined in the URL so that we can just update it
  2. if parameter is already defined in the URL, so replace the parameter value, rather than append it to the end.
  3. else, can simply append to the end of the URL, once we know whether this is the only parameter in there or not.

 

 

first check whether the parameter is already defined in the URL so that we can just update it

,

No comments yet.

Leave a Reply