I have an url like below http://www.grcparfum.it/home.php?section=letteradelpresidente&lang=eng
in this URL language is english
lang=eng
i wanna call different JS file when lang is different
I have an url like below http://www.grcparfum.it/home.php?section=letteradelpresidente&lang=eng
in this URL language is english
lang=eng
i wanna call different JS file when lang is different
Here's a function that can get the querystring variables in JS for you:
function $_GET(q){
var $_GET = {};
if(document.location.toString().indexOf('?') !== -1){
var query = document.location
.toString()
.replace(/^.*?\?/, '')//Get the query string
.replace(/#.*$/, '')//and remove any existing hash string
.split('&');
for(var i=0, l=query.length; i<l; i++){
var aux = decodeURIComponent(query[i]).split('=');
$_GET[aux[0]] = aux[1];
}
}
return $_GET[q];
}
Does this help at all?