We are using servisable pin code api provided by our logistic partner at shopify information checkout page.
when pin code is valid(means servisable) then response in json format is perfectly worked but when we enter no servisable(any 6 digit wrong pin code) then showing bad request 400 error.
How to handle this?
Here is my code code
$(document).ready(function() {
var from_pincode = 134113;
$("#checkout_shipping_address_zip").keyup(function() {
var to_pincode = $('#checkout_shipping_address_zip').val();
if (to_pincode.length == 6) {
var zipcodeurl = "https://www.pickrr.com/api/check-pincode-service/?from_pincode=" + from_pincode + "&to_pincode=" + to_pincode + "&auth_token=********";
$.ajax({
url: zipcodeurl,
type: "GET",
format: "json",
success: function(data) {
console.log(data);
}
});
}
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>