AH TM表单国籍采用IP自动判断

master
Jimmy Liow 2 years ago
parent 97393716a5
commit 6d3dfc8c9d

@ -1566,7 +1566,7 @@ right: 5px;">
<span id="contact_error_msg" class="hidden">(Please fill out
this field.)</span>
<div class="inputTerm" style="margin-bottom: -10px;">
<select class="country_code" name="country_code">
<select class="country_code" name="country_code" id='country_code'>
<option style="font-weight: 600;" value="United States +1">United States&nbsp; &nbsp;+1</option>
<option style="font-weight: 600;" value="United Kingdom +44">United Kingdom&nbsp; &nbsp;+44
</option>
@ -2111,6 +2111,22 @@ margin-right: 10px;
});
})(document, new URLSearchParams(new URL(window.location.href).search));
</script>
<script>
$(function () {
$.getJSON("https://www.asiahighlights.com/index.php/apps/ip2location/index/get_country", function(data) {
var yourCountry = data.country_name;
$('#country_code option').each((i, optionEle) => {
var countryName = optionEle.value.split('+')[0].trim();
if (yourCountry === countryName) {
optionEle.selected = true;
}
});
})
.fail(function(xhr, status, error) {
console.error(error);
});
})
</script>
<script>
$(function () {
var $adultBlock = $('#adultBlock');

@ -1317,7 +1317,7 @@
</div>
<div id="contact_error_msg" class="hidden">(Please fill out this field.)</div>
<div class="inputTerm" style="margin-bottom: -10px;">
<select class="country_code" name="country_code">
<select class="country_code" name="country_code" id='country_code'>
<option style="font-weight: 600;" value="United States +1">United States&nbsp; &nbsp;+1</option>
<option style="font-weight: 600;" value="United Kingdom +44">United Kingdom&nbsp; &nbsp;+44
</option>
@ -2112,4 +2112,31 @@ margin-right: 10px;
});
});
</script>
<script>
((doc, urlParams) => {
doc.addEventListener('DOMContentLoaded', () => {
const productCode = urlParams.get('product_code');
if (productCode != null) {
const productCodeInput = doc.getElementById('product_code');
productCodeInput.value = productCode;
}
});
})(document, new URLSearchParams(new URL(window.location.href).search));
</script>
<script>
$(function () {
$.getJSON("https://www.asiahighlights.com/index.php/apps/ip2location/index/get_country", function(data) {
var yourCountry = data.country_name;
$('#country_code option').each((i, optionEle) => {
var countryName = optionEle.value.split('+')[0].trim();
if (yourCountry === countryName) {
optionEle.selected = true;
}
});
})
.fail(function(xhr, status, error) {
console.error(error);
});
})
</script>
Loading…
Cancel
Save