Question: New to json/jQuery so sorry if this has an obvious answer.

I'm doing an ajax request in jQuery that's something like:

```
$.ajax({
  url: theURL,
  dataType: 'jsonp',
  type: 'get',
  success: function(data) {
    alert("it's there");
  }
});

```

The request asks whether a given object is in a database. If it is, it returns something of the format:

```
{
  "text": "duck",
  "canonical_name": "duck",
  "language": {
    "id": "en"
  }
}

```

However, if the object isn't there, it returns:

```
Not Found

```

As in...literally that exact string, not in any kind of json format as far as I know. Is there any way I can get my ajax to detect this? Right now it doesn't even seem to be acknowledging that it got anything back in the latter case.

The json code wasn't written by me. It can possibly be fixed if this is not the correct format and there's absolutely nothing I can do from my end to work with this, but I'd really like to try to find some kind of workaround if possible.

Thanks very much!

Answer: 
Its not possible to directly get the ip addresses allotted to any country like that.
IP numbers are allocated to regional internet registries. 

There are 5 of them , ARIN , APNIC , AFRINIC , LACNIC , RIPE

And again , these RIR allot ip ranges to ISPs of a country.

By doing a whois query for an ip you can find out which RIR is the IP allocated to. The whois response will also contain the country and ISP of the ip address.

Basically you need to whois-query all ip ranges and aggregate the data and form a database. Such a database can be then used to provide all ip addresses belonging to a certain country.
IANA does not have this information so, no, there is no way to get it from them.

IANA only allocates big IP prefixes to RIR (Regional Internet Registries). For instance 31.0.0.0/8 has just been allocated to the [RIPE-NCC](http://www.ripe.net/) (by the way, one less IPv4 prefix, time to enable IPv6 if it is not already done), which covers all Europe and a good part of the Middle East. So, these adresses may go to Ireland, Jordan or Greece and you cannot tell it from IANA allocations. Even the RIR whois (`whois.ripe.net` for the RIPE-NCC) won't tell you with enough details because a prefix may be assigned to a multinational IAP (Internet Access Provider).