Get query string parameters url values with jQuery / Javascript (querystring) - Stack Overflow
Tue Oct 05 2021 12:47:45 GMT+0000 (Coordinated Universal Time)
Saved by
@khalidlogi
//URL is http://www.example.com/mypage?ref=registration&email=bobo@example.com
$.urlParam = function (name) {
var results = new RegExp('[\?&]' + name + '=([^&#]*)')
.exec(window.location.search);
return (results !== null) ? results[1] || 0 : false;
}
console.log($.urlParam('ref')); //registration
console.log($.urlParam('email')); //bobo@example.com
content_copyCOPY
https://stackoverflow.com/questions/7731778/get-query-string-parameters-url-values-with-jquery-javascript-querystring
Comments