$( document ).ready(function() { var url = 'https://ajax.xv-cdn.net/ajax/country'; if (!is_bot()) { try { var xhr = window.XMLHttpRequest ? new window.XMLHttpRequest : window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : null; xhr.open("GET", url, !0), xhr.onreadystatechange = function() { if (4 === this.readyState && 200 == this.status) { country_detect = xhr.responseText.toLowerCase(); var url = '/xvideos/index.php/assets/trend_keyword_contry/' + country_detect + '/'; $.get(url, null, function(data) { $( "#nav_trends_index" ).html(data); }); } }, xhr.send(null) } catch (e) { console.log("can't do ajax request") } } });