【问题标题】:How to set the value of text dynamically in jQuery.qrcode如何在jQuery.qrcode中动态设置文本的值
【发布时间】:2020-01-30 06:38:25
【问题描述】:

我尝试使用下面的代码使用最新的 DateTime 填充 qrcode,但没有任何反应。但是,如果我尝试手动设置 qrcode 显示的文本的值。

我正在使用这个plugin

var options = "";
    var url_date = "@Url.Action("GetDate", "Test")"
    $.get(url_date, function (e) {

        $("span[class='DatePrinted']").html(e);
        console.log("DatePrinted: " + e);

        options = {
            render: 'div',
            minVersion: 1,
            maxVersion: 1,
            ecLevel: 'L',
            left: 0,
            top: 0,
            size: 75,
            text: e.toString(),
            radius: 0,
            quiet: 0,
            mode: 0
        }
    }).done(function () {
        $("div[class='qr_code']").qrcode(options);
    });

【问题讨论】:

    标签: jquery qr-code


    【解决方案1】:
            // clearing the inner html first
            $("#qr_code").html("");
            $('#qr_code').qrcode({
              render: 'canvas', 
              width: 140, 
              height: 140, 
              text: data,  // data is a variable
              // mode: 3,
              // image:"./URLSHRT/Pagelogo.png",
              // mode: 1, 
              // label:'www.urlshrt.co',
              // fontname:'sans',
              // fontcolor:'#000',
              // background:'#000', 
              // foreground:'#FD5353', 
              // padding : 50
            });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-26
      • 2014-02-11
      • 1970-01-01
      • 1970-01-01
      • 2017-02-09
      • 2019-07-23
      相关资源
      最近更新 更多