Im sending over some json data and assigning to a hidden field using:
@Html.Hidden("hidden-places", @Model.Places)
inside my javascript i am doing the following to retrieve the data:
var places = $('#hidden-places').val();
however it just comes back as undefined.
i am using this for google maps…
i tried something like:
$(document).ready(function () {
places = $('#hidden-places').val();
// Onload handler to fire off the app.
google.maps.event.addDomListener(window, 'load', initialize);
});
but no luck.
I had multiple elements with the same id on the page causing the problem