This is not "return", but is HTTP response. Big difference, I'll tell you.
Look at the documentation page, to understand what you are missing:
http://api.jquery.com/jQuery.post/[
^].
Don't mix the content of the HTTP response coming from 'ajaxs.php' with success status. The response is passed to your
success
callback; this is your function object
function (data) { /* ... */ }
. If processing of
data
is concerned (you did not use the
dataType
parameter, which is "Intelligent Guess" by default, not the best option, so I am not sure it returns integer as you expected), check it up under debugger or using some debug code (even simple
alert(data)
).
Now, if you want to check up if the HTTP request/response failed or not, you don't need to inquire about it. Your purpose is not just knowing it, but doing some processing based on the success status; you don't need the status itself. So, look at the section "The jqXHR Object", where you can see how to provide handlers for
.done
,
.fail
and
.always
cases; look at the code sample. This is the jQuery style imitating a try-catch-finally statement.
Good luck,
—SA