BotDetect Ajax CAPTCHA Documentation
Unlike Recaptcha the Stalker -- BotDetect CAPTCHA works in China! Licensable source-code; self-hosted -- doesn't stalk -- nor does it slurp your form-data! Think: GDPR & LGPD!
This page is an index of BotDetect Captcha documentation regarding Ajax Captcha validation: code examples, how to guides and Ajax implementation options available in different versions of BotDetect.
Related information can be found in similar pages about jQuery Captcha and JavaScript Captcha.
Ajax CAPTCHA in ASP.NET
There are several different approaches you can take when implementing Ajax Captcha validation of BotDetect ASP.NET Captcha, depending on your Ajax framework of choice and the amount and format of data exchanged by the client and server during Captcha validation through Ajax requests.
ASP.NET Unobtrusive Validation Ajax Captcha
BotDetect Captcha can be validated as part of ASP.NET unobtrusive validation of form fields in both ASP.NET MVC and ASP.NET WebForms applications. This approach to Ajax Captcha validation is shown in the ASP.NET MVC application template Captcha example and the ASP.NET WebForms application template Captcha example.
[back to the top of the page]
Getting the CAPTCHA Validation Result as JSON
If you prefer to handle the Ajax client-side workflow of Captcha validation yourself, you can make an Ajax request to the BotDetect Captcha handler validation end-point Url, available through the ValidationUrl
property of the BotDetect client-side object.
For example, if you make an Ajax GET request to
FormCaptcha.ValidationUrl + "&i=" + userCaptchaCodeInput // TODO: read input
you will get the Captcha validation result as a simple true
or false
JSON value.
[back to the top of the page]
Partially Submitting the Form to Validate the CAPTCHA
If you prefer a custom Ajax implementation that submits the user Captcha code input to a custom end-point in your server-side ASP.NET code, you just need to ensure that you submit the CaptchaId
and InstanceId
values (available as Id
and InstanceId
properties of the BotDetect client-side object) along with the user input.
You can then get the Captcha validation result by passing these extra parameters to the static Validate()
method of the BotDetect.Web.CaptchaControl
class:
// TODO: add these values to the Ajax request on the client-side
string userInput = Request.Params["userInput"] as string;
string captchaId = Request.Params["captchaId"] as string;
string instanceId = Request.Params["instanceId"] as string;
bool isHuman = BotDetect.Web.Captcha.Validate(captchaId, userInput,
instanceId);
[back to the top of the page]
Ajax CAPTCHA in Java
There are several different approaches you can take when implementing Ajax Captcha validation of BotDetect Java Captcha, depending on your Ajax framework of choice and the amount and format of data exchanged by the client and server during Captcha validation through Ajax requests.
Getting the CAPTCHA Validation Result as JSON
If you prefer to handle the Ajax client-side workflow of Captcha validation yourself, you can make an Ajax request to the BotDetect Captcha handler validation end-point Url, available through the ValidationUrl
property of the BotDetect client-side object.
For example, if you make an Ajax GET request to
formCaptcha.ValidationUrl + "&i=" + userCaptchaCodeInput // TODO: read input
you will get the Captcha validation result as a simple true
or false
JSON value.
[back to the top of the page]
Partially Submitting the Form to Validate the CAPTCHA
If you prefer a custom Ajax implementation that submits the user Captcha code input to a custom end-point in your server-side Java code, you just need to ensure that you submit the CaptchaId
and InstanceId
values (available as Id
and InstanceId
properties of the BotDetect client-side object) along with the user input.
You can then get the Captcha validation result by passing these extra parameters to the validate()
method of the Captcha
class:
// TODO: add these values to the Ajax request on the client-side
String userInput = request.getParameter("userInput");
String captchaId = request.getParameter("captchaId");
String instanceId = request.getParameter("instanceId");
Captcha captcha = Captcha.load(request, captchaId);
boolean isHuman = captcha.validate(userInput, instanceId);
[back to the top of the page]
Ajax CAPTCHA in PHP
There are several different approaches you can take when implementing Ajax Captcha validation of BotDetect PHP Captcha, depending on your Ajax framework of choice and the amount and format of data exchanged by the client and server during Captcha validation through Ajax requests.
Getting the CAPTCHA Validation Result as JSON
If you prefer to handle the Ajax client-side workflow of Captcha validation yourself, you can make an Ajax request to the BotDetect Captcha handler validation end-point Url, available through the ValidationUrl
property of the BotDetect client-side object.
For example, if you make an Ajax GET request to
FormCaptcha.ValidationUrl + "&i=" + userCaptchaCodeInput // TODO: read input
you will get the Captcha validation result as a simple true
or false
JSON value.
[back to the top of the page]
Partially Submitting the Form to Validate the CAPTCHA
If you prefer a custom Ajax implementation that submits the user Captcha code input to a custom end-point in your server-side PHP code, you just need to ensure that you submit the CaptchaId
and InstanceId
values (available as Id
and InstanceId
properties of the BotDetect client-side object) along with the user input.
You can then get the Captcha validation result by passing these extra parameters to the Validate()
function of the Captcha
class:
// TODO: add these values to the Ajax request on the client-side
$userInput = $_REQUEST['userInput'];
$captchaId = $_REQUEST['captchaId'];
$instanceId = $_REQUEST['instanceId'];
$ExampleCaptcha = new Captcha($captchaId);
$isHuman = $ExampleCaptcha->Validate($userInput, $instanceId);
[back to the top of the page]