I am creating a web application, and I want to show the user IP address and location by getting these attributes from other cross domain like ipapi.com, but I am getting problem in AJAX request from my domain.
I have code sample as given below.
$('.send').on('click', function(){
$.getJSON('https://ipapi.co/'+$('.ip').val()+'/json', function(data){
$('.city').text(data.city);
$('.country').text(data.country);
});
});
How do I fix this problem?
Your Error was ‘Access-Control-Allow-Origin’ missing To overcome this, you need to configure your servers to send the headers: Access-Control-Allow-Origin null or Access-Control-Allow-Origin