I am displaying and determining the selected language in my website by using URLs in this format :
/{languageCode}/Area/Controller/Action
And in my C# when I need to find the language Code I am using this syntax :
RouteData.Values["languageCode"]
However, when I need to call an action using JQuery, how do I determine the language code so that I can call the correct route i.e. en-US/Area/Controller/Action ? I don’t know how to access this information in my client side Javascript. Can anybody help?
Since your URL has the language code. How about using
https://developer.mozilla.org/en/DOM/window.location
And then extract the language from the url. Maybe something like:
No need to use JQuery! 🙂