【问题标题】:How to pass the string in original format to javascript function如何将原始格式的字符串传递给javascript函数
【发布时间】:2020-02-11 13:11:38
【问题描述】:

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

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

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

【问题讨论】:

标签: javascript c# resx


【解决方案1】:

这对我有用。

@Html.Raw(HttpUtility.JavaScriptStringEncode(YouLabel)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-06-10
    • 1970-01-01
    • 2012-03-30
    • 1970-01-01
    • 2014-10-02
    • 2020-08-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多