1

I want to get user's location and store that in a variable. My code works fine but it is showing this warning:

[Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.

This is my code:

var myJson = $.ajax({
    url: requestUrl,
    async: false,
    dataType: 'json'
}).responseJSON;

var country = myJson.country;

console.log(country);

Thanks

h_h10a
  • 449
  • 5
  • 18

0 Answers0