Questions about handling data and error in $.ajax response
<p>I'm using jquery and php for some async job.
I'm using <code>$.ajax</code> with <code>beforesend</code>, <code>complete</code>, <code>success</code> and <code>error</code>.
I made the async POST request to a php that execute some mysql query and return true (string "1" in fact) if all is ok and false (string "0").
Back to js I procedd the data return in the success function (or complete?).
Should I have to handle data with</p>

<pre><code>if (data=="1")
  alert("ok")
else
  alert("ko")?
</code></pre>

<p>Is this the correct way?</p>

<p>Another question, the error function of $.ajax is for the ajax request itself nad not for the result of the operation?
Thanks</p>
