1
var api;
(function() {
     api = new FacePP('api_secret', 'api_key');
    api.request('detection/detect', {
      url:'http://apius.faceplusplus.com' 
    }, function(err, result) {
      if (err) {
          alert(err);

        return;
      }
      // TODO use result
      document.getElementById('response').innerHTML= JSON.stringify(result, null, 2);
    });
  })();

I am calling faceplusplus detection api using javascript.But when I run this code I can see error in browser console Cross-Origin Request Blocked and getting blank "" json response.Please suggest how can I fix it using above code. And also api is sending image downloading error. This code is using facepp-sdk.min.js. please help. Already there are some posts like How do I send a cross-domain POST request via JavaScript? But I am unable to figure out how will I merge my request in ths format.

Community
  • 1
  • 1
  • possible duplicate of [How do I send a cross-domain POST request via JavaScript?](http://stackoverflow.com/questions/298745/how-do-i-send-a-cross-domain-post-request-via-javascript) – Gábor Bakos Mar 19 '15 at 18:13
  • But how can I use above code. Code mentioned in post mentioned by you using the different request format. I am sending api key and api secret. – user2760542 Mar 19 '15 at 18:20

0 Answers0