keeehlan
keeehlan

Reputation: 8054

Responding to an AJAX call with only Success or Failure?

I have an MVC Ajax form, and I'm only using it to perform some basic operations.

I'm coding in C#, HTML, Razor, and jQuery.

What I'd like to do is only respond with one of two possibilities, success or failure.

With what do I respond to the AJAX call to specify either success or failure? Status codes? I can't seem to find any documentation on this for some reason.

Thanks in advance.

Upvotes: 1

Views: 103

Answers (1)

rekire
rekire

Reputation: 47945

I would simply return the json {"success":true} or {"success":false}.

This is plain simple and should do it's job.

Upvotes: 1

Related Questions