I am using jquery ajax. Ajax call is working fine but data inside div is not updating. OnSuccess it gets full page html :(
View (MyDataView.cshtml):
<div id="userGridDiv">
<a id="lnkName" style="cursor:pointer">Name</a>
//This div also contain other data....
</div>
@section scripts{
<script type="text/javascript">
$(document).ready(function () {
$("#lnkName").click(function () {
$.ajax({
url: '@Url.Action("ShowData", "Controller")',
type: "POST",
data: { id: 1, sort: "Name" },
}
}).done(function () {
}).success(function (dv) {
alert(dv)
})
a$.ajaxOptions(
{
UpdateTargetId : "userGridDiv",
})
});
});
Contoller Method is:
public ViewResult ShowSata(int id, string data)
{
var model = GetDBData(id, data);
View("MyDataView")
}
Please let me know what i am doing wrong.