如何在视图(cshtml)中调用 javascript 函数并传递一些字符串变量(在视图中定义)用作函数调用的参数?
假设函数 javascriptFunction 使用 2 个参数。我通常将其称为javascriptFunction('param1', 'param2')
. 但现在我想传递一些变量。
string y = "this is a string"
string x = "another"
javascriptFunction(y, x)
我试过 javascriptFunction(@y, @x), javascriptFunction('@y', '@x') 但这不起作用