Initialize on click event

Jan 21, 2014 at 6:40 PM
I am new in MVC 4 and started using Grid.mvc.ajax having trouble calling this grid in click event as partial view here is code for click event and controller.

$("#searchaccount").click(function () {
$.ajax(
    {
        url: 'Grid',
        type: 'GET',
        datatype: 'json',
        contentType: "application/json; charset=utf-8",
        success: function (result) {
            alert('Success');
            alert(result);
            $("#searchresults").html(result);
        },

        error: function (error) {
            alert('Fail');
        }
    });
});
    public ActionResult Grid(int? page)
    {
        AccountLookupModel model = new AccountLookupModel();
        var data = model.GetAccountData();

        var grid = new AjaxGridFactory().CreateAjaxGrid(data, page.HasValue ? page.Value : 1, page.HasValue);

        return Json(new { Html = grid.ToJson("AccountSearchResults", this), grid.HasItems }, JsonRequestBehavior.AllowGet);
    }
Any help would be appreciated. Thanks.