I'm newbie to mvc 4 and jquery mobile and what i'm trying to do is display a map using jquery-ui-map library.
Here is what I've:
1) On the layout page I've the following code at the bottom before "end of body" tag
@Scripts.Render("~/bundles/jquery","~/bundles/jqueryui")
@Scripts.Render("~/bundles/jquerymobile")
@RenderSection("scripts", required: false)
2) On the Index View I've the following Actionlink
@Html.ActionLink("Display Map","Map", "Home", null,
new { data_role = "button", data_theme = "b", data_mini = "true" })
When I click on the above action link, It will take the user location and 'll display the marker on a google map.
On the MAP view page I've the following code at the bottom
@section scripts{
<script type="text/javascript" src="http://maps.google.com/maps/apis?sensor=false">
</script>
<script type="text/javascript" src="@Url.Content("~/Scripts/map/demo.js")"></script>
@Scripts.Render("~/Scripts/map/jquery.ui.map.min.js")
@Scripts.Render("~/Scripts/map/jquery.ui.map.overlays.min.js")
@Scripts.Render("~/Scripts/map/jquery.ui.map.extensions.js")
$(function () {
//code to display the map
});
}
Here is the issue I'm having.... When I click on the action link it will display the Map View but no map is displayed.
If I refresh the page (f5 or click on browser refresh icon), it will call the $function()
and the map is displayed.
- Am I doing something wrong with
@section
tag? - How do I force the page to reload it.. I've tried do
Ajax.Actionlink
, or setcacheduration
to zero in Controller Action method, still no go.
I've tried all the available questions and answers in this forum and still I didn't get it to work.
Any idea why this is happening?