3

因此,虽然 LiveAddress 非常适合美国地址,但我们也必须支持国际地址。我已经有一个国家下拉菜单,仅当该人选择美国时才启用 LiveAddress。但是,我现在需要在有人选择美国以外的国家/地区时“禁用”LiveAddress。

$(".chosen-select").on("change", function (e) {
    if (e.added.id == "USA") {
        showUSStates();
        $.LiveAddress("<My Key>");
    } else if (e.added.id == "CAN") {
        showCANProvinces();
        //Disable Live Address here?
    } else {
        //Disable Live Address here?
        $("label[for=State]").html("Province");
        $("#State").hide()
        $("#Province").show()
        $("#State").empty();
    }
});

谢谢!

解决方案:

所以它没有记录在他们的网页中,但我阅读了未最小化的js 文件,发现如果你映射国家字段,一旦有人选择美国以外的国家,他们的库会自动关闭。

   $(document).ready(function () {
        showUSStates();
        $.LiveAddress({
            key: "<My Key>",
            addresses: [{ 
                id: 'billing', 
                street: '#Address1', 
                city: '#City', 
                state: '#State', 
                zipcode: '#PostalCode', 
                **country: '#Country'** }],
            autoVerify: false
        });
    });

很棒的功能,不幸的是在线文档没有详细说明这个功能,在线聊天团队也不知道这个功能。

4

1 回答 1

1

http://smartystreets.com/kb/liveaddress-api/plugin/advanced列表autoVerify(...)

autoVerify([newSetting]) ver 2.4.3+
Pass in a truthy value to turn on auto-verify, or a falsey value to turn it off. Don't pass in anything to simply return the current autoVerify setting.

我不确定这是否是你要找的?

编辑 deactivate(...)activate(...)可能对你更有用?

于 2013-12-20T10:15:07.847 回答