Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getURLVar(key) {
- var value = [];
- var query = String(document.location).split('?');
- if (query[1]) {
- var part = query[1].split('&');
- for (i = 0; i < part.length; i++) {
- var data = part[i].split('=');
- if (data[0] && data[1]) {
- value[data[0]] = data[1];
- }
- }
- if (value[key]) {
- return value[key];
- } else {
- return '';
- }
- } else {
- var query = String(document.location.pathname).split('/');
- if (query[query.length - 1] == 'cart') value['route'] = 'checkout/cart';
- if (query[query.length - 1] == 'checkout') value['route'] = 'checkout/checkout';
- if (value[key]) {
- return value[key];
- } else {
- return '';
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement