Using Razor within JavaScript

后端 未结 12 2301
萌比男神i
萌比男神i 2020-11-22 04:12

Is it possible or is there a workaround to use Razor syntax within JavaScript that is in a view (cshtml)?

I am trying to add markers to a Google map...

12条回答
  •  既然无缘
    2020-11-22 04:53

    What specific errors are you seeing?

    Something like this could work better:

    
    

    Note that you need the magical tag after the foreach to indicate that Razor should switch into markup mode.

提交回复
热议问题