Javascript-如何更新Cookie,以便拨打新号码而不是默认号码?

时间:2018-08-16 06:47:53

标签: javascript jquery freeswitch mod-verto

当我调用manual_dial()时,它总是拨12127773456而不是32448899000。为什么pop方法不更新cookie verto_demo_ext

有什么建议吗?

// Cookie library
// https://freeswitch.org/stash/projects/FS/repos/freeswitch/raw/html5/verto/video_demo/js/jquery.cookie.js?at=67dad0639867bbc64fa404b30caad2889ea80899

var dial______________________number = '12127773456';
function pop(id, cname, dft) {
  var tmp = $.cookie(cname) || dft;
  $.cookie(cname, tmp, {
    expires: 365
  });
  $(id).val(tmp).change(function () {
    $.cookie(cname, $(id).val(), {
      expires: 365
    });
  });
}

function init() {
  pop("#ext", "verto_demo_ext", dial______________________number);
}

function manual_dial() {
  pop("#ext", "verto_demo_ext", '32448899000');
}

1 个答案:

答案 0 :(得分:1)

将行var tmp = $.cookie(cname) || dft;更改为var tmp = dft || $.cookie(cname);

相对于传递给函数的值,您更倾向于cookie。更改顺序以优先选择传递给函数的值