{"id":1608,"date":"2015-04-03T00:15:42","date_gmt":"2015-04-02T18:45:42","guid":{"rendered":"http:\/\/naveenbalani.com\/?p=1608"},"modified":"2016-09-17T09:23:46","modified_gmt":"2016-09-17T03:53:46","slug":"invoking-alchemy-face-detection-service-using-jquery","status":"publish","type":"post","link":"https:\/\/navveenbalani.dev\/index.php\/articles\/invoking-alchemy-face-detection-service-using-jquery\/","title":{"rendered":"Invoking Alchemy Face Detection service using JQUERY"},"content":{"rendered":"<p>Here is a\u00a0sample reference on how to invoke Alchemy Face Detection service using JQUERY. \u00a0The details were not available on the website, so I decided to build one quickly.\u00a0I would use this only for quick experimentation as it exposes the client key on the browser side.<\/p>\n<p>Here is the index.html file &#8211;<\/p>\n<p>&lt;!doctype html&gt;<br \/>\n&lt;html lang=&#8221;en&#8221;&gt;<br \/>\n&lt;head&gt;<br \/>\n&lt;meta charset=&#8221;utf-8&#8243;&gt;<br \/>\n&lt;meta http-equiv=&#8221;X-UA-Compatible&#8221; content=&#8221;IE=edge,chrome=1&#8243;&gt;<br \/>\n&lt;script src=&#8221;http:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/2.0.3\/jquery.min.js&#8221;&gt;&lt;\/script&gt;<br \/>\n&lt;script src=&#8221;script.js&#8221;&gt;&lt;\/script&gt;<br \/>\n&lt;\/head&gt;<br \/>\n&lt;body&gt;<\/p>\n<p>&lt;h1&gt;File Upload&lt;\/h1&gt;<\/p>\n<p>&lt;form action=&#8221;#&#8221; method=&#8221;post&#8221;&gt;<br \/>\n&lt;ul&gt;<br \/>\n&lt;li&gt;<br \/>\n&lt;label for=&#8221;name&#8221;&gt;Name:&lt;\/label&gt;<br \/>\n&lt;input type=&#8221;text&#8221; name=&#8221;name&#8221; id=&#8221;name&#8221; multiple&gt;<br \/>\n&lt;\/li&gt;<\/p>\n<p>&lt;li&gt;<br \/>\n&lt;label for=&#8221;file_upload&#8221;&gt;File:&lt;\/label&gt;<br \/>\n&lt;input type=&#8221;file&#8221; name=&#8221;file_upload&#8221; id=&#8221;file_upload&#8221; multiple&gt;<br \/>\n&lt;\/li&gt;<\/p>\n<p>&lt;li&gt;&lt;input class=&#8221;button green&#8221; type=&#8221;submit&#8221; name=&#8221;submit&#8221; value=&#8221;Submit Content&#8221;&gt;&lt;\/li&gt;<br \/>\n&lt;\/ul&gt;<br \/>\n&lt;\/form&gt;<br \/>\n&lt;\/body&gt;<br \/>\n&lt;\/html&gt;<\/p>\n<p>Here is the Javsacript file (script.js)\u00a0code<\/p>\n<p>$(function()<br \/>\n{<\/p>\n<p>var files;<\/p>\n<p>\/\/ Add events<br \/>\n$(&#8216;input[type=file]&#8217;).on(&#8216;change&#8217;, prepareUpload);<br \/>\n$(&#8216;form&#8217;).on(&#8216;submit&#8217;, uploadFiles);<br \/>\nfunction prepareUpload(event)<br \/>\n{<br \/>\nfiles = event.target.files;<br \/>\n}<br \/>\nfunction uploadFiles(event)<br \/>\n{<br \/>\nevent.stopPropagation();<br \/>\nevent.preventDefault();<\/p>\n<p>$.ajax({<\/p>\n<p>url :&#8217;http:\/\/access.alchemyapi.com\/calls\/image\/ImageGetRankedImageFaceTags?apikey=yourkey&amp;outputMode=xml&amp;imagePostMode=raw&#8217;,<br \/>\ntype: &#8216;POST&#8217;,<br \/>\ndata : files[0],<br \/>\ncache: false,<br \/>\nprocessData: false,<br \/>\ncontentType: &#8216;application\/x-www-form-urlencoded&#8217;,<br \/>\nsuccess: function(data, textStatus, jqXHR)<br \/>\n{<br \/>\nif(typeof data.error === &#8216;undefined&#8217;)<br \/>\n{<br \/>\nconsole.log(&#8216;Data: &#8216; + jqXHR.responseText);<\/p>\n<p>}<br \/>\nelse<br \/>\n{<br \/>\nconsole.log(&#8216;ERRORS: &#8216; + data.error);<br \/>\n}<br \/>\n},<br \/>\nerror: function(jqXHR, textStatus, errorThrown)<br \/>\n{<br \/>\nconsole.log(&#8216;ERRORS: &#8216; + textStatus);<\/p>\n<p>}<br \/>\n});<br \/>\n}<\/p>\n<p>});<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here is a\u00a0sample reference on how to invoke Alchemy Face Detection service using JQUERY. \u00a0The details were not available on the website, so I decided to build one quickly.\u00a0I would use this only for quick experimentation as it exposes the client key on the browser side. Here is the index.html file &#8211; &lt;!doctype html&gt; &lt;html [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2102,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,157],"tags":[162,161],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.0.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Invoking Alchemy Face Detection service using JQUERY - Current and Future Technology Trends by Navveen Balani<\/title>\n<meta name=\"description\" content=\"Invoking Alchemy Face Detection service using JQUERY -\" \/>\n<link rel=\"canonical\" href=\"https:\/\/navveenbalani.dev\/index.php\/articles\/invoking-alchemy-face-detection-service-using-jquery\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Invoking Alchemy Face Detection service using JQUERY - Current and Future Technology Trends by Navveen Balani\" \/>\n<meta property=\"og:description\" content=\"Invoking Alchemy Face Detection service using JQUERY -\" \/>\n<meta property=\"og:url\" content=\"https:\/\/navveenbalani.dev\/index.php\/articles\/invoking-alchemy-face-detection-service-using-jquery\/\" \/>\n<meta property=\"og:site_name\" content=\"Current and Future Technology Trends by Navveen Balani\" \/>\n<meta property=\"article:published_time\" content=\"2015-04-02T18:45:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-09-17T03:53:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/navveenbalani.dev\/wp-content\/uploads\/2016\/07\/bk2.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"450\" \/>\n\t<meta property=\"og:image:height\" content=\"450\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data1\" content=\"2 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/navveenbalani.dev\/#website\",\"url\":\"https:\/\/navveenbalani.dev\/\",\"name\":\"Current and Future Technology Trends by Navveen Balani\",\"description\":\"Current and Future Technology Trends by Navveen Balani\",\"publisher\":{\"@id\":\"https:\/\/navveenbalani.dev\/#\/schema\/person\/51f7ab14b20611d95e3c7fd4ea0950bf\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/navveenbalani.dev\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/invoking-alchemy-face-detection-service-using-jquery\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/navveenbalani.dev\/wp-content\/uploads\/2016\/07\/bk2.jpg\",\"width\":450,\"height\":450},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/invoking-alchemy-face-detection-service-using-jquery\/#webpage\",\"url\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/invoking-alchemy-face-detection-service-using-jquery\/\",\"name\":\"Invoking Alchemy Face Detection service using JQUERY - Current and Future Technology Trends by Navveen Balani\",\"isPartOf\":{\"@id\":\"https:\/\/navveenbalani.dev\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/invoking-alchemy-face-detection-service-using-jquery\/#primaryimage\"},\"datePublished\":\"2015-04-02T18:45:42+00:00\",\"dateModified\":\"2016-09-17T03:53:46+00:00\",\"description\":\"Invoking Alchemy Face Detection service using JQUERY -\",\"breadcrumb\":{\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/invoking-alchemy-face-detection-service-using-jquery\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/navveenbalani.dev\/index.php\/articles\/invoking-alchemy-face-detection-service-using-jquery\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/invoking-alchemy-face-detection-service-using-jquery\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/navveenbalani.dev\/\",\"url\":\"https:\/\/navveenbalani.dev\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/invoking-alchemy-face-detection-service-using-jquery\/\",\"url\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/invoking-alchemy-face-detection-service-using-jquery\/\",\"name\":\"Invoking Alchemy Face Detection service using JQUERY\"}}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/invoking-alchemy-face-detection-service-using-jquery\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/invoking-alchemy-face-detection-service-using-jquery\/#webpage\"},\"author\":{\"@id\":\"https:\/\/navveenbalani.dev\/#\/schema\/person\/51f7ab14b20611d95e3c7fd4ea0950bf\"},\"headline\":\"Invoking Alchemy Face Detection service using JQUERY\",\"datePublished\":\"2015-04-02T18:45:42+00:00\",\"dateModified\":\"2016-09-17T03:53:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/invoking-alchemy-face-detection-service-using-jquery\/#webpage\"},\"publisher\":{\"@id\":\"https:\/\/navveenbalani.dev\/#\/schema\/person\/51f7ab14b20611d95e3c7fd4ea0950bf\"},\"image\":{\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/invoking-alchemy-face-detection-service-using-jquery\/#primaryimage\"},\"keywords\":\"cognitive,cognitive computing\",\"articleSection\":\"Articles,Cognitive Computing\",\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/navveenbalani.dev\/#\/schema\/person\/51f7ab14b20611d95e3c7fd4ea0950bf\",\"name\":\"Navveen\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/navveenbalani.dev\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/navveenbalani.dev\/wp-content\/uploads\/2019\/07\/navveen_balani.jpeg\",\"width\":200,\"height\":200,\"caption\":\"Navveen\"},\"logo\":{\"@id\":\"https:\/\/navveenbalani.dev\/#personlogo\"},\"sameAs\":[\"http:\/\/naveenbalani.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/posts\/1608"}],"collection":[{"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/comments?post=1608"}],"version-history":[{"count":2,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/posts\/1608\/revisions"}],"predecessor-version":[{"id":1642,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/posts\/1608\/revisions\/1642"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/media\/2102"}],"wp:attachment":[{"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/media?parent=1608"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/categories?post=1608"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/tags?post=1608"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}