Is there a way I can run custom code when PageUpdater.Update is done? I need to reload the page after the user has selected a different country code (the cart checks if items are valid for a given country). When I try code like this (from AddressUser.cshtml):
useBillingAddress = function () { document.querySelectorAll("input[name^='EcomOrderDelivery']").forEach(function (field) { field.removeAttribute("disabled"); }); swift.PageUpdater.Update(document.querySelector("#ordersubmit")); location.reload() };
it fails in Firefox because somehow the GET request from location.reload() cancels the post from PageUpdater.Update:
Currently, I use setTimeout and wait for half a second, but I rather execute the code immediate when PageUpdater.Update is done, like so:
swift.PageUpdater.Update(document.querySelector("#ordersubmit"), location.reload());
but that doesn't work currently. Is there a callback option on Update I can use? Or an alternative?
Imar