Using Inline C# inside Javascript File in MVC Framework

后端 未结 9 1764
野性不改
野性不改 2020-12-31 07:39

I am trying to get inline C# to work in my JavaScript files using the MVC Framework. I made this little test code up.

$(document).ready(function() {
    ale         


        
9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-31 08:07

    I agree with Serhat. It's best to render an HTML Hidden field, or, as Al mentioned, go to a URL for it. This can be done through a Web Service or even an IHttpHandler implementation. Then you could use a url such as "messages.axd?id=17".

提交回复
热议问题