Advertisement
Guest User

Untitled

a guest
Aug 26th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. var utils = (function () {
  2.  
  3. var getParameter = function (name, url) {
  4. if (!url) url = window.location.href;
  5. name = name.replace(/[\[\]]/g, "\\$&");
  6. var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
  7. results = regex.exec(url);
  8. if (!results) return null;
  9. if (!results[2]) return '';
  10. return decodeURIComponent(results[2].replace(/\+/g, " "));
  11. };
  12.  
  13. var redirect = function (url) {
  14.  
  15. window.location.href = url;
  16.  
  17. };
  18.  
  19. return {
  20. getParameter: getParameter,
  21. redirect:redirect
  22. };
  23.  
  24. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement