Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. function updateURLParameter(url, param, paramVal) {
  2. var newAdditionalURL = "";
  3. var tempArray = url.split("?");
  4. var baseURL = tempArray[0];
  5. var additionalURL = tempArray[1];
  6. var temp = "";
  7. if (additionalURL) {
  8. tempArray = additionalURL.split("&");
  9. for (var i=0; i<tempArray.length; i++){
  10. if(tempArray[i].split('=')[0] != param){
  11. newAdditionalURL += temp + tempArray[i];
  12. temp = "&";
  13. }
  14. }
  15. }
  16.  
  17. var rows_txt = temp + "" + param + "=" + paramVal;
  18. return baseURL + "?" + newAdditionalURL + rows_txt;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement