Here is a sample reference on how to invoke Alchemy Face Detection service using JQUERY.  The details were not available on the website, so I decided to build one quickly. I would use this only for quick experimentation as it exposes the client key on the browser side.

Here is the index.html file –

<!doctype html>
<html lang=”en”>
<meta charset=”utf-8″>
<meta http-equiv=”X-UA-Compatible” content=”IE=edge,chrome=1″>
<script src=””></script>
<script src=”script.js”></script>

<h1>File Upload</h1>

<form action=”#” method=”post”>
<label for=”name”>Name:</label>
<input type=”text” name=”name” id=”name” multiple>

<label for=”file_upload”>File:</label>
<input type=”file” name=”file_upload” id=”file_upload” multiple>

<li><input class=”button green” type=”submit” name=”submit” value=”Submit Content”></li>

Here is the Javsacript file (script.js) code


var files;

// Add events
$(‘input[type=file]’).on(‘change’, prepareUpload);
$(‘form’).on(‘submit’, uploadFiles);
function prepareUpload(event)
files =;
function uploadFiles(event)


url :’’,
type: ‘POST’,
data : files[0],
cache: false,
processData: false,
contentType: ‘application/x-www-form-urlencoded’,
success: function(data, textStatus, jqXHR)
if(typeof data.error === ‘undefined’)
console.log(‘Data: ‘ + jqXHR.responseText);

console.log(‘ERRORS: ‘ + data.error);
error: function(jqXHR, textStatus, errorThrown)
console.log(‘ERRORS: ‘ + textStatus);



Tags : cognitivecognitive computing

The author Navveen