MVC Ajax call not firing

I have a jquery function:

function ExpireSession() {
                type: "POST",
                url: '@Url.Action("LogOffSession","Account")',
                dataType: "json",
                success: function (data) {
                error: function (data) {

The action method that is called from the above function is:

    public ActionResult LogOffSession()
        return Json(new { result = true });

The jquery function is called(i tested with an alert) but the action method is not being called. I tried giving something in success and error functions but no effect.

I also tried by giving the jquery function like this

function ExpireSession() {
            var url = '@Url.Action("LogOffSession", "Account")';
            $.post(url, null, function (data) {
                return true;

but still it is not working.

What is that I am doing wrong?

Source: ajax

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.