Return to Snippet

Revision: 61865
at January 21, 2013 05:21 by goo


Updated Code
function getParameterByName(name) {
    var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
    return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
getParameterByName( "parameterName" )

Revision: 61864
at January 21, 2013 05:20 by goo


Initial Code
function getParameterByName(name) {
    var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
    return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
var video_id = getParameterByName("v");

var url = "http://www.videoscop.com/watch/?v=" + video_id;

window.location.href = url;

Initial URL
http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values

Initial Description
Get Parameter from url query string

Initial Title
[JAVASCRIPT] Get Parameter from url query string

Initial Tags
query

Initial Language
JavaScript