I am developing custom shipping module for magento 2.2.
When you're filling out the Shipping Address form in Magento 2, periodically Magento will make an ajax request for the URL
http://magento.example.com/rest/default/V1/guest-carts/[hash]/estimate-shipping-methods
I changed postcode text field to autocomplete text field. Now when i type something in text field it make ajax request to above mention url. But after two or three character type, it shows auto suggest fields(which i added in autocomplte) and if I select one from that it doesn't generate any ajax call.
I added autocomplete code in my custom js as per below
setTimeout(function(){
jQuery("input[name='postcode']").autoSuggest(data.items,
{
selectedItemProp: "name",
searchObjProps: "name",
selectionLimit: 1,
minChars: 3,
selectionAdded: function(elem)
{
result = elem.text();
getresultval(result);
}
}
);
}, 6000);
So, my problem is when I write on text box it works but when I select something from auto suggestion it doesn't work. That means issue is with binding event of postcode text field.
So how to resolve this?