0

Can't seem to find the answer I'm looking for on here...

NULL is passed to my ASP.net controller - iid does have a value.

function Dismiss(iid) {
    $.ajax({url: '@Url.Action("DismissNotification")', type: 'GET',Data: {id:iid}, success: function(result){
            $('#' + id).hidden();
    }});
}

[Authorize]
[HttpGet]
public bool DismissNotification(string id)
{
    if (!string.IsNullOrEmpty(id))
    {
        _notificationService.Dismiss(id);
        return true;
    }

    return false;
}

Any ideas?

1 Answer 1

1

The settings property in which the client sends data to server is called data , not Data

This should work

$.ajax({
    url: '@Url.Action("DismissNotification")',
    type: 'GET',
    data: { id: iid },
    success: function (result) {
        console.log('result',result);
}});

You can also use the $.get method as well

$.get('@Url.Action("DismissNotification")', { id: iid }, function (result) {
    console.log('r', result);
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.