繁体   English   中英

如何将原始格式的字符串传递给javascript函数

[英]How to pass the string in original format to javascript function

我在下面有一个 Javascript 函数,它采用在 resx.file 中定义的标签...标签类似于:来自客户价目表的成功。

enter code here: $(function () {
    systemadminhourlyrateindex().init(
        '@Html.Raw(Label.SuccessDeleteIsDelegated)' //At this point label is as origin.
    );
});

但是当我尝试在 JS 函数中使用它时,它并没有正确地从客户的单引号中逃脱。 相反,它在客户这个词中添加了一些奇怪的字符。 所以它变得像customer---s where --- is & # 3 9; 也许这是单引号的ascii?

这对我有用。

@Html.Raw(HttpUtility.JavaScriptStringEncode(YouLabel)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM