I have url that goes like this
http://wwww.example.com/eng/about/what
I want to have new var like this in Jquery, that is working in IE8
var lang ="eng"
;
And replace innerHTML of element, for now i have something like this
$(document).ready(function () {
var lang = "ENG";
$(".dropdown-toggle").html(lang + "<b class='caret'></b>");
});'
The problem is that var eng can we somethin else, i have tried with indexOF, but no luck?
And if there is no value inside i must use default
var lang = "eng";
EDITED
For now we have made it to this
$(document).ready(function () {
var url = window.location.protocol + "//" + window.location.host + "/" + window.location.pathname;
var arr = url.split("/");
var lang = (arr[1] != undefined) ? arr[1] : "en";
});
The problem is on default loading of index page, it means, what some one get on home page
Hi only gets
http://wwww.example.com/
But sometime he gets
http://wwww.example.com/fr
or something else depends on language