Difference between revisions of "Reading QueryString parameters using JavaScript"

From All n One's bxp software Wixi

Jump to: navigation, search
 
(No difference)

Latest revision as of 16:21, 26 July 2015

It is possible to read QueryString parameters from any page in bxp.


In the fn_javascript_general.js library included on every page is a function called fn_Gen_getParameterByName(name)


Using this function call on any page in bxp allows you to check for the existence of a querystring parameter.


Using this page as an example we could write


//Firstly we pull the parameter into a variable
var strTitle = fn_Gen_getParameterByName("title");

//Now we check if the parameter was found
if (strTitle){
	//Now only do something if the variable has some contents
	if (strTitle != ''){
		//If the variable contains what you are looking for
		if (strTitle == 'Reading_QueryString_parameters_using_JavaScript'){
			//Perform whatever action you need.
			alert('Your page detected');
		}
	}
}