Created
November 23, 2015 10:20
-
-
Save xto3na/9095068c5a62b679369a to your computer and use it in GitHub Desktop.
Get Parameter From URL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getProductId = function () { | |
var searchElems = {}; | |
if(location.search) { | |
var pair = (location.search.substr(1)).split('&'); | |
for (var i = pair.length - 1; i >= 0; i--) { | |
var param = pair[i].split('='); | |
searchElems[param[0]] = param[1]; | |
}; | |
return searchElems.product_id; //Получаем нужный параметр через точку | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment