Let’s say you send a model called “MyModel” from controller to view. In Controller: … var result = new MyModel() { Id = 1, Name = “Ercan”, FavoriteTeam = “Galatasaray”, FavoriteGame = “Half Life Series” } return View(result); … and now we will send this model which comes with result to Javascript via setName function: […]
Tag: pass
Passing parameters to JavaScript files
You can assign an id to the <script> element and passing the arguments as data-* attributes. The resulting <script> tag would look something like this: