<input type="text" id="OrderNumber"/>
<input type="button" id="btn" value="Track Order" onclick="fetchOrderTrackingUrl()"/>
<script>
function fetchOrderTrackingUrl() {
const orderNumber = document.getElementById('OrderNumber').value;
const apiUrl = 'https://luxeurs.com/admin/orders.json?name=' + orderNumber;
fetch(apiUrl)
.then(response => response.json())
.then(data => {
const trackingUrl = data.order.tracking_url;
window.open(trackingUrl, '_blank');
})
.catch(error => {
console.error(error);
});
}
</script>
<input type="button" id="btn" value="Track Order" onclick="fetchOrderTrackingUrl()"/>
<script>
function fetchOrderTrackingUrl() {
const orderNumber = document.getElementById('OrderNumber').value;
const apiUrl = 'https://luxeurs.com/admin/orders.json?name=' + orderNumber;
fetch(apiUrl)
.then(response => response.json())
.then(data => {
const trackingUrl = data.order.tracking_url;
window.open(trackingUrl, '_blank');
})
.catch(error => {
console.error(error);
});
}
</script>