I have a mvc3 view (map.cshtml) that has a javascript section in it.
I have a controller (MapController.cs) that has a function that will return a string.
I need to call the function from within the javascript area of the cshtml page,
and have it render the results directly into the javascript block prior to being processed and displayed.
The whole task is to create a series or infowindows for the google map, and because the data is so scattered around the system, the codebehind function gathers this data, and places it into html code and i need this html code to be injected into the javascript block prior to being displayed.
whew...
thanks
Here is the actual code block i am currently using...
@functions { private string getContent() { return "testing"; } }
var map;
function initialize() { var myLatlng1 = new google.maps.LatLng(29.64032, -82.363129); var myLatlng2 = new google.maps.LatLng(29.64032, -81.363129);
var myOptions = {
zoom: 10,
center: myLatlng1,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);
var test = 'X@{getContent();}';
So - in the var test.... i would like it to read.... Xtesting