日期:2014-05-17  浏览次数:20502 次

mvc4 中ajax为何老是在新窗口中打开页面呢?
Controllers:
 //Ajax

        public ActionResult DailyDeal()
        {
            var album = getDailDeal();
            return PartialView("_DailDeal",album);
        }

        private Album getDailDeal()
        {
            return db.Albums.First();
        }


View:
<div id="dailydeal">
@Ajax.ActionLink("Click","DailyDeal","AlbumInfo",
new AjaxOptions(){
    UpdateTargetId = "dailydeal",
    InsertionMode = InsertionMode.Replace,
    HttpMethod = "GET"
})
</div>

------解决方案--------------------
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>