B4J Question Send data to a javascript function

TomDuncan

Active Member
Licensed User
Hi All,
I have a websocket routine that I would like to send some json data to from my B4J.
this is the html <script> side

B4X:
  $(document).ready(function() {
    var data = #json#;

    var $lastEvent = $('#last_event_example_6');
    var $lastEventContainer = $('#last_event_example_container_6');
    
    var $flowchart = $('#example_6');

 
    function drawimage(data) {
        $flowchart.flowchart('setData', data);
    }

etc...
and here is the ws code on a send button click.

B4X:
Sub loaddata_click (Params As Map)
'    Log("clicked")
    Dim s As String = File.ReadString(File.DirApp,"json/temp.json")
    ws.RunFunction("drawimage",Array(s))
    ws.Flush
End Sub
The loaddata button is working ok but nothing is being sent to flowchart.
Any thoughts on what this novice is doing wrong.
Tom
 
Top