is there anyway i can access my resource files (.resx) in javascript?
if no then are there any workarounds to diplay messages in javascript in different languages?
4 Answers
If your javascript is in the page you can use:
var globalResource = '<%= Resources.YourClass.YourResourceKey %>';
to access the Global Resources (/App_GlobalResources). Or
var localResource = '<%= GetLocalResourceObject("LocalResourceKey").ToString() %>';
to access the Local resources (/App_LocalResources relative to the page position).
Or a javascript solution may be this nice jQuery plugin.
Comments
i did it by using Jquery ajax which calls a serverside GetGlobalResourceObject()
1 Comment
JefClaes
I hope you're not using this to resolve each and every resource.. That's a nice to way to spam your server.