When clicking on ajax.actionlink in its oncomplete function I can't update the html of a div whith requested data
Posted
by
Milka Salkova
on Stack Overflow
See other posts from Stack Overflow
or by Milka Salkova
Published on 2014-06-01T09:20:08Z
Indexed on
2014/06/01
9:25 UTC
Read the original article
Hit count: 166
In one partial view I've got some ajax.ActionLinks which when clicked update the div 'importpartupdate' (they just updates the div whith new ajax.actionLinks with other routevalues). The problem is that when this update is competed I have to update another div - depending on which link is clicked . That's why in my OnComplete function of my ajax.ActionLink I make an ajax request to the action'GridViewLanguage' which returns me the partial view which should uodate this other div which claass .floatLanguage
. So the first time when I click a link eeverything works correctly and my two divs are correctly updated. But the second time I click a new link it seems the the floatlanguuage div is not updated like somehow the browser is caching the previous info I don't know. \i tried with cache:false- nothing worked.
@model MvcBeaWeb.GroupMenu
<nav class="sidebar-nav">
<div class="divLeftShowMenu">
<ul>
@{
if (Model != null)
{
foreach (MvcBeaDAL.WebServiceBeaMenu item in Model.MenuLeft)
{
<li>
@Ajax.ActionLink(@item.SpecialWord, "ImportShow", new { id = Model.LanguageName, menuID = item.ID, articlegroupID = item.ArticlegroupID, counter = 1 }, new AjaxOptions { UpdateTargetId = "importPartUpdate", HttpMethod = "GET", InsertionMode = InsertionMode.Replace, OnComplete = "success("[email protected]+")" }, new { id=item.ID})
</li>
}
}
}
</ul>
</div>
</nav>
<script>
function success(ids) {
var nocache = new Date().getTime();
jQuery.ajax({
url: '@Url.Action("GridLanguageView")/?menuID='+ids
}).done(function (data)
{
$(".floatLanguage").replaceWith(data);
alert(data);
});
}
</script>
© Stack Overflow or respective owner