jquery get parameter from url
function GetUrlParameter(sParam)
{
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
{
return sParameterName[1];
}
}
}
And this is how you can use this function assuming the URL is,
http://dummy.com/?technology=jquery&blog=jquerybyexample.
var tech = GetUrlParameter('technology');
var blog = GetUrlParameter('blog');var currentURL = $(location).attr('href');
var currentURL = window.location.href;
Also in JavaScript:
- how to sort array least to greatest javascript stACK
- nodejs hello world
- js check if number has decimals
- dropdown list value react fragment
- socket emit to specific room using nodejs socket.io
- js clone array
- how to initialize empty javascript object
- nestjs version
- filter in react native video
- jquery populate select from json
- vuejs my chart load before fetch data
- angular 8 to 9
- js array find regex
- react lifecycle
- react native elements
- disable copy past jquery
- javascript select letter in string
- logical operators javascript
- reacts mos twanted
- add class to radium
- how to split two digit number in javascript
- javascript check if array is not empty
- javascript includes method
- movement of objects in javascript