Question: I am a publisher that is contracted to serve an ad to only US users. We are serving this ad using geoIP database from MaxMind to identify IP addresses.

Based on DoubleClick metrics, we are showing that of 3200 impressions served, 7% are still being served outside the US (Germany, France, India, Italy, UK with the most impressions).

Is there a better technology to geo-target ads to the US?

Answer: 
try this, (using recursion)

```
var counter = 1;

var ajaxFunc = function(){

    $.ajax({
      url: 'http://api.test.com',
      method: "POST",
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      data: data
    })
    .done(function(returnObj) {
      return returnObj;
    })
    .fail(function(err) {
      console.log(err);
      counter++;
      if(counter<=3) ajaxFunc();
    });
}
ajaxFunc(); // first call

```
```
$.ajax({
  url: 'http://api.test.com',
  method: "POST",
  contentType: "application/json; charset=utf-8",
  dataType: "json",
  data: data
  tryCount : 1,
  retryLimit : 3,
  error: function(xhr, textStatus, err){
       if (this.tryCount <= this.retryLimit) {
           console.log("error")
           this.tryCount++;
           $.ajax(this);
       } else {
               console.log("max number ...");
              }
            }
})
.done(function(returnObj) {
  return returnObj;
})
.fail(function(err) {
  console.log(err);
});

```