TagBuilder를 사용하여 JavaScript를 작성하는 메서드에 C# 문자열 배열을 전달하고 있습니다.C# 문자열 배열을 Javascript 배열로 변환
var rss_scr_contents = new Array();
$.each('System.String[]', function (i, objValue) {
rss_scr_contents[i] = objValue;
});
할 수있는 올바른 구문은 무엇 : 이것은 다음과 같은 소스 코드를 초래
public static IHtmlString NewsTicker(this HtmlHelper htmlHelper, string[] arrTickerContents)
{
TagBuilder script = new TagBuilder("script");
script.Attributes.Add("type", "text/javascript");
script.InnerHtml = @"
var rss_scr_contents = new Array();
$.each('" + arrTickerContents + @"', function (i, objValue) {
rss_scr_contents[i] = objValue;
});
return MvcHtmlString.Create(script.ToString());
}
: 내 자바 스크립트에서 배열 내 실제 항목에서 얻을 수하지 않는 것 이?
우수 답변! – user517406