Use ASP.NET Resource strings from within javascript files

后端 未结 9 1704
迷失自我
迷失自我 2020-12-13 01:02

How would one get resx resource strings into javascript code stored in a .js file?

If your javascript is in a script block in the markup, you can use this syntax:

9条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-13 01:26

    use a hidden field to hold the resource string value and then access the field value in javascript for example : " />

    var todayString= $("input[name=TodayString][type=hidden]").val();

提交回复
热议问题