Well, this time will be shortly as always. I wanted to get value from some param in URL. After some research this could be done by this code (I use it):

/**
 * Function getValueFromURLparam
 * Extracting Querystring key/value pairs
 */

var getValueFromURLparam = function(name, url)
{
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp( regexS );
	var results = regex.exec(url);
	return (results === null) ? "" : results[1];
};
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Comments

You can leave a response, or trackback from your own site.

Before you add comment see for rules.

Leave a Reply

Your email address will not be published. Required fields are marked *

2i4s3q