B4J Question B4J server set image HTML

Mostez

Well-Known Member
Licensed User
Longtime User
I've html page and it has an image, I want to set html property of that image to display generated QR image, the qr image generated OK and saved in the same www folder of index.html,
this method did not work, please advice.

TIA

HTML:
<img class="qrcodeimg" title="qrcode" />

B4X:
Private qrcodeimg As JQueryElement

B4X:
Sub Upload_Click (Params As Map)
        
    ws.Session.RemoveAttribute("employeeid")
    ws.Session.RemoveAttribute("password")
    
    Dim nameF As Future = employeeid.GetVal
    Dim pwordF As Future = password.GetVal

    Dim name As String = nameF.Value
    Dim pw As String = pwordF.Value
    
    Dim Employee As clsEmployee
    Employee.Initialize
    
    Wait For (Employee.CanLogin (name,pw)) complete (canlog As Boolean)
    If canlog Then
        GenerateQR(name)
    End If
End Sub

B4X:
private Sub GenerateQR(Val As String)   
    Dim img As String = File.Combine(Main.AssetFolder, "qrlogin")
    Dim generate As ZXing
    generate.Initialize
    generate.QrCode(Val, 400, File.Combine(img, "image.png"), "png")
    Dim Html As String = $"<img class="qrcodeimg" src="image.png" title="qrcode" />"$
    qrcodeimg.SetHtml(Html)
    ws.Flush
End Sub
Image1.jpg
 
Top