I'm using some Boostrap libraries, like the alert balloons, and would like to show them depending on the AJAX result, how can I send a post with AJAX and return the errors / successes in the divs, in this case it's best to return in JSON or plain text, since the errors are independent?
<form action="" method="post">
<input type="text" name="teste" />
<input type="submit" name="post" />
</form>
The back end (PHP) part is already done, and would return JSON, eg:
Error: JSON = > {"error": "1", "name": "incorrect"}
<div class="alert alert-danger fade in">
<p>O form contém erros bla bla</p>
</div>
Success: JSON = > {"error": "0"}
<div class="alert alert-success fade in">
<p>Salvo com sucesso!</p>
</div>