Old Man
Old Man

Reputation: 3445

Making Asynchronous calls in ASP.Net MVC 3

I'm using $.ajax asynchronously to send some json to a controller marked with [HttpPost], like this:

 $.ajax({
            url:          location.href,
            type:        'post',
            contentType: 'application/json',
            dataType:    'json',
            data:        theJson,
            async:       true,
        });

This works fine, but the method expects an ActionResult, I guess with a new view. But I don't want that - I just want to do a little update on the server without updating the page.

Is there any way to set up a method on the server to do the update, independent of the view?

Upvotes: 1

Views: 838

Answers (1)

SLaks
SLaks

Reputation: 887315

You should change the method to return void.

Upvotes: 2

Related Questions