Get url parameter jquery Or How to Get Query String Values In js
Get url parameter jquery Or How to Get Query String Values In js
Credit : http://stackoverflow.com/questions/19491336/get-url-parameter-jquery-or-how-to-get-query-string-values-in-js
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};
ex. http://[url]/?technology=jquery&blog=jquerybyexamplevar tech = getUrlParameter('technology');
var blog = getUrlParameter('blog');
Credit : http://stackoverflow.com/questions/19491336/get-url-parameter-jquery-or-how-to-get-query-string-values-in-js
ความคิดเห็น
แสดงความคิดเห็น