Redirect Based on Country IP

$.getJSON(‘http://ip-api.com/json?callback=?’, function(data) {
console.log(JSON.stringify(data, null, 2));
if(data.country !=”Iraq”){
alert(“You are not authorised to access the system from ” + data.country + “please contact the administrator”);
//window.location.replace(“http://google.com”);
}
});