My goal is to refresh a partial View containing an interactive world map. I have a Controller action
public JavaScriptResult DynMap(int id, List<int> relevantCountries = null){}
which returns the map data as JavaScriptResult.
I call this Javascript in my Partial View "MapSite" with
<script src="/JS/DynMap/@ViewBag.GameRoomID"></script>
The Partial View "MapSite"
public ActionResult MapSite(int id)
{
ViewBag.GameRoomID = id;
return PartialView("MapSite");
}
is rendered into my main page like this:
<td id="map">
@{Html.RenderAction("MapSite", "JS");}
</td>
That works perfectly fine! But if I want to render MapSite again at runtime (with new values) like this: $('#map').load('/JS/MapSite/4')(4 is static for testing), the Partial View comes without the DynMap Javascript.
Is this a bug? Isn't it possible to load external Javascript this way "live"? It even hits the breakpoint inside the Controller DynMap method, but the map is empty, because the DynMap values are missing.
Aucun commentaire:
Enregistrer un commentaire