Advertisement
Guest User

Untitled

a guest
Jun 20th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.36 KB | None | 0 0
  1. function getUrlParams(prop) {
  2.     var params = {};
  3.     var search = decodeURIComponent(window.location.href.slice(window.location.href.indexOf('?') + 1));
  4.     var definitions = search.split('&');
  5.     definitions.forEach(function (val, key) {
  6.         var parts = val.split('=', 2);
  7.         params[parts[0]] = parts[1];
  8.     });
  9.     return (prop && prop in params) ? params[prop] : params;
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement