Web 2.0 API: getting Data from Javascript

Until now I am getting Data from Javascript only via Hashtag. Is there another way to transfer Data from Jscript to xojo cause Hashtag is sometimes really a problem especially if the amount of data is big…thanks for answering

There will be a WebSDK documentation soon. For now you can look at the examples folder under “Web” there is WebSDK with some examples.

But no way to get data from JavaScript … sadly not… but thank you for the answer

There is a way, even many ways. You’ve not looked or overlooked it.
You need to look at the events, those can be called by i’m not sure (since there is no docs yet) this.triggerServerEvent(…???..) and it would parse data back

As far as I know this is not implemented yet. So I will have to wait a year or two, it s okay. Thanks for answering and gave a good night Derk

The WebSDK is implemented and functioning. I’ve been converting my Web products over for quite a while now.

1 Like

I ment the functionality byself, the ask is implemented but in wide range under construction

There are many many many many ways to get data from JavaScript.

1 Like

It’s already implemented. Just not documented.

This could be it:
XojoWeb.controls.lookup(controlID).triggerServerEvent(‘MyServerEventName’, obj);

Anthony, is the new WebSDK a different animal from Web 1.00 implementation entirely, or do older Web 1.00 custom controls still work ?

It is really unfortunate that zero documentation or examples are provided yet.

The new WebSDK is entirely different, but perfectly usable and manageable. An example is available in the Examples. I have three of my products fully converted and working with the other 50+ not far behind. All pass data back and forth between Xojo and JS.

1 Like

Bildschirmfoto 2020-08-31 um 11.26.00


Bildschirmfoto 2020-08-31 um 11.27.29

Wow, that is cool!

yes, I would really have it soon on desktop too !

There are several examples in Examples > Web > WebSDK.

It’ll get there.

Interesting is: there are exactly two examples for WEB API 2.0. Never mind, I still need a documentation and will wait for it, cause Javascript events will be needed for my next Project.

Ok, lets be clear about this up front since I’ve gotten several queries about this over the last eight months. You cannot make code like this:

Var js as String = CallSomeMethodThatGetsJavascriptFromTheBrowser()

Getting data from the browser is always asynchronous and if you try to fake it with DoEvents, you’re going to make performance terrible when there are more than just a few users.

The way this will work will be:


…and then sometime hopefully in the not too distant future…

Event MethodCallback(js as JSONItem)
    var x a string = js.value("from_client")
End Event

I’ve emphasized hopefully there because while 99.9% of the time, you will get a response, there’s always the possibility that you won’t. Network conditions, packet loss, JavaScript or Xojo exceptions, or heck, maybe the user just left your app.


I was looking in Extras. Old habits die hard :wink:

Thank you, Greg

1 Like

How do we separate different answers from the frontend. For instance when our control has two buttons and I want to know which one was clicked?

Send along a JSON string that tells you.

1 Like