im trying to return from controller partial view using ajax while debugging i see that the correct data sent to controller but when the controller finished to do what his need he moved automaticly to function Dispose instead to return the partial view

the code in the controller is:

    public PartialViewResult SearchPosts(string keyword)
    {
        var data = db.Posts.Where(f => f.Title.Contains(keyword) || f.Author.Contains(keyword)).ToList();
        return PartialView("_SearchPostsPArtial", data);
    }

and partial code code from the View is:

$(document).ready(function () { $('#buttonSearch').click(function () { var keyword = $('#searchAjax').val(); $.ajax({ url: '@Url.Action("SearchPosts", "Posts")', contentType: 'application/html; charset=utf-8', type: 'GET', data: { keyword: keyword }, dataType: 'html' }) .success(function (result) { $('#result').html(result); }) .error(function (xhr, status) { console.debug(status); }) }); });

Related posts

Recent Viewed