Get URL Variables/parameters values With JavaScript

javscript function ///
//name = Pass URl parameter
function getParameterByName(name) {
var match = RegExp('[?&]' + name + '=([^&]*)').exec(;
var result= match && decodeURIComponent(match[1].replace(/\+/g, ' '));

// ]]>

and buttun onclick event onclick=”javascript:getParameterByName(‘utm_source’);”
URL = javascript_get_parameter.html?utm_source=massmail&utm_medium=email&utm_campaign=21-feb-2015


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s