1

Basically, I have an array of emails (attemptsArray) that I look up using FullContact's API.

attemptsArray.forEach(function(attempt) {
    $.fullcontact.emailLookup(APIKEY, attempt, function(obj) {
        attemptsMade = attemptsMade + 1
        console.log(attemptsMade);
        console.log('Looking up '+attempt+' ...This is attempt number'+attemptsMade)

        if (obj.status == 200) {
            var score = obj.likelihood;
            console.log('Matched with a '+score+' likelihood')
            correctAttempts.push(obj);
        };
    });
});

However, if a 404 is returned (i.e., the email doesn't exist), it doesn't increment attemptsMade. Is there any way to ensure that this happens? I've tried doing an if (obj.status == 404) and that doesn't work either.

kba
  • 19,333
  • 5
  • 62
  • 89
Alex Schiff
  • 101
  • 1
  • 7
  • I see a `$` in there; is this a jQuery plugin? I assume you're using this: http://www.fullcontact.com/developer/docs/libraries/ – Tieson T. Mar 29 '14 at 22:26
  • 4
    I suspect that all of those lookups are going to be launched at essentially the same time. It's (almost certainly) an asynchronous API. – Pointy Mar 29 '14 at 22:29
  • 1
    Really, really weird. It's clearly said in the `$.ajax` doc for `error` option: `This handler is not called for cross-domain script and cross-domain JSONP requests.` Yet this API is attempting to use it ... yep, for JSONP requests (check [this line](https://github.com/fullcontact/fullcontact-api-jquery-plugin/blob/master/jquery.fullcontact.1.0.js#L30)) Is it even tested, I wonder? ) – raina77ow Mar 29 '14 at 22:31
  • Have you figured this out yet? – ChuckKelly Mar 30 '14 at 09:01

0 Answers0