I have the following input field for username:
<input type="email" class="form-control" id="txt_username" name="username" data-parsley-trigger="change" data-parsley-remote="/User/user_exists" data-parsley-remote-options='{ "type": "POST", "dataType": "json", "data": { "request": "ajax" } }'>
This works fine and calls my PhP function
:
public function user_exists()
{
if($this->isAjax())
{
$user = $this->getDatabase()->prepTemplate('SELECT * FROM User WHERE username = ? ', 's', array($_POST['username']), MySqlTemplates::RFQ_FM);
if($user != null)
{
print json_encode("400");
}
else
{
print json_encode("200");
}
}
}
However i am unsure what to do to either deny or allow the validation.
the documentation isnt much of help (atleast i have trouble finding it)
Can anyone give me a push in the right direction?