iOS Question b4i CallSub

arifkibrit

Member
Licensed User
Hi, i try to search but couldn't find sorry if repost

i am using this code in B4A and it works for me but what i did and changed i couldn't trigger Subs

WebView1.ExecuteJavascript("document.getElementById('ELEMENT_ID').addEventListener('click', event => {B4A.CallSub('BuyMe',true,document.getElementById('ELEMENT_ID').target)})")

i tried so many things pls help me...
 

jahswant

Well-Known Member
Licensed User
Longtime User
B4X:
Private Sub RunJavaScript (js As String) As ResumableSub
    #if B4A
    WebViewExtras1.executeJavascript(WebView1, $"B4A.CallSub('Process_HTML', true, ${js})"$)
    Wait For Process_Html(html As String)
    Return html
    #Else If B4J
    Return WebView1.As(JavaObject).RunMethodJO("getEngine", Null).RunMethod("executeScript", Array(js))
    #Else If B4i
    Dim sf As Object = WebView1.EvaluateJavaScript(js)
    Wait For (sf) WebView1_JSComplete (Success As Boolean, Result As String)
    Return Result
    #end if
End Sub
 
Upvote 0
Top