var SearchString = window.location.search.substring(1);
var KeyValuePair = SearchString.split('=');
for(var i = 0; i < KeyValuePair.length; i++){
//seem not to be working
var KeyValuePair = KeyValuePair[i].split(',');
if(KeyValuePair[0] == VarSearch){
return KeyValuePair[1];
}
The example website address is: http://google.com/?type=talks. window.location.search retrieves "type=talks" and then split "=" away. The words will be "type, talks". Need to match "talks" with "talks" in json: type.
Is there a easy way to retrieve the last word after split '=' away?
Update The split word will be only ONE word. There is no "&" between the url address in. The retrieved word will be "type=talks" so need to take "talks" out from the retrieved word. "Talks" word will be compared with "talks" in json