c# - Add JavaScript code to View dynamically -
i have code display google map. in controller, create javascript:
mapcode = string.format("<script type='text/javascript'>init_map('my_map', {0}, {1}, 20)</script>", location.location.coordinate.latitude, location.location.coordinate.longitude)
but can't write view:
@model.mapcode
because displays actual javascript - doesn't execute it.
is there way this?
you pass location.location
model , on view:
<script type='text/javascript'>init_map('my_map', '@model.coordinate.latitude', '@model.coordinate.longitude', 20)</script>
in manner don't have build script controller, not idea.
Comments
Post a Comment