[jQuery] Ajax and Rails

[jQuery] Ajax and Rails


I'm totally sure this has been asked and answered 1_000_000 times, but
Google has let me down on this one. I'm using a link to trigger an
ajax call that create a row in the database. On successful completion,
a row in the DOM is appended.
Getting around to the question (you knew there was a question in here
someplace, right?), I'm trying to return some JSON on success or an
array of errors on failure. My failure also sets the HTTP status to
"406 Unprocessable Entity". Firebug confirms this is all happening,
but my $.ajax call always triggers the success: callback.
What is the magic differentiator that $.ajax uses to discern between a
successful and failing server response?
TIA
Steve