# Web 2.0 API: getting Data from Javascript

**URL:** <https://forum.xojo.com/t/web-2-0-api-getting-data-from-javascript/56490>\
**Category:** Web\
**Created:** [August 30, 2020, 5:42pm UTC](https://forum.xojo.com/t/web-2-0-api-getting-data-from-javascript/56490 "2020-08-30T17:42:01Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thorsten\_Stueker](https://forum.xojo.com/user_avatar/forum.xojo.com/thorsten_stueker/32/1165_2.png) [@Thorsten\_Stueker](https://forum.xojo.com/u/Thorsten_Stueker)\
**Post date:** [August 30, 2020, 5:42pm UTC](https://forum.xojo.com/t/web-2-0-api-getting-data-from-javascript/56490/1 "2020-08-30T17:42:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![DerkJ](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@DerkJ](https://forum.xojo.com/u/DerkJ)\
**Post date:** [August 30, 2020, 7:01pm UTC](https://forum.xojo.com/t/web-2-0-api-getting-data-from-javascript/56490/2 "2020-08-30T19:01:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Thorsten\_Stueker](https://forum.xojo.com/user_avatar/forum.xojo.com/thorsten_stueker/32/1165_2.png) [@Thorsten\_Stueker](https://forum.xojo.com/u/Thorsten_Stueker)\
**Post date:** [August 30, 2020, 7:11pm UTC](https://forum.xojo.com/t/web-2-0-api-getting-data-from-javascript/56490/3 "2020-08-30T19:11:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![DerkJ](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@DerkJ](https://forum.xojo.com/u/DerkJ)\
**Post date:** [August 30, 2020, 7:14pm UTC](https://forum.xojo.com/t/web-2-0-api-getting-data-from-javascript/56490/4 "2020-08-30T19:14:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Thorsten\_Stueker](https://forum.xojo.com/user_avatar/forum.xojo.com/thorsten_stueker/32/1165_2.png) [@Thorsten\_Stueker](https://forum.xojo.com/u/Thorsten_Stueker)\
**Post date:** [August 30, 2020, 8:04pm UTC](https://forum.xojo.com/t/web-2-0-api-getting-data-from-javascript/56490/5 "2020-08-30T20:04:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Anthony\_G\_Cyphers](https://forum.xojo.com/user_avatar/forum.xojo.com/anthony_g_cyphers/32/16862_2.png) [@Anthony\_G\_Cyphers](https://forum.xojo.com/u/Anthony_G_Cyphers)\
**Post date:** [August 31, 2020, 12:31am UTC](https://forum.xojo.com/t/web-2-0-api-getting-data-from-javascript/56490/6 "2020-08-31T00:31:26Z")

</div>

The WebSDK is implemented and functioning. I’ve been converting [my Web products](https://demo2.graffitisuite.com/) over for quite a while now.

---

<div class="post-metadata">

**Author:** ![Thorsten\_Stueker](https://forum.xojo.com/user_avatar/forum.xojo.com/thorsten_stueker/32/1165_2.png) [@Thorsten\_Stueker](https://forum.xojo.com/u/Thorsten_Stueker)\
**Post date:** [August 31, 2020, 3:58am UTC](https://forum.xojo.com/t/web-2-0-api-getting-data-from-javascript/56490/7 "2020-08-31T03:58:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Austin\_Clow](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/8edcca/32.png) [@Austin\_Clow](https://forum.xojo.com/u/Austin_Clow)\
**Post date:** [August 31, 2020, 5:01am UTC](https://forum.xojo.com/t/web-2-0-api-getting-data-from-javascript/56490/8 "2020-08-31T05:01:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![DerkJ](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@DerkJ](https://forum.xojo.com/u/DerkJ)\
**Post date:** [August 31, 2020, 5:04am UTC](https://forum.xojo.com/t/web-2-0-api-getting-data-from-javascript/56490/9 "2020-08-31T05:04:36Z")

</div>

It’s already implemented. Just not documented.

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

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [August 31, 2020, 8:28am UTC](https://forum.xojo.com/t/web-2-0-api-getting-data-from-javascript/56490/10 "2020-08-31T08:28:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Anthony\_G\_Cyphers](https://forum.xojo.com/user_avatar/forum.xojo.com/anthony_g_cyphers/32/16862_2.png) [@Anthony\_G\_Cyphers](https://forum.xojo.com/u/Anthony_G_Cyphers)\
**Post date:** [August 31, 2020, 9:04am UTC](https://forum.xojo.com/t/web-2-0-api-getting-data-from-javascript/56490/12 "2020-08-31T09:04:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Lars\_Lehmann](https://forum.xojo.com/user_avatar/forum.xojo.com/lars_lehmann/32/11818_2.png) [@Lars\_Lehmann](https://forum.xojo.com/u/Lars_Lehmann)\
**Post date:** [August 31, 2020, 9:27am UTC](https://forum.xojo.com/t/web-2-0-api-getting-data-from-javascript/56490/13 "2020-08-31T09:27:41Z")

</div>

![Bildschirmfoto 2020-08-31 um 11.26.00](https://forum.xojo.com/uploads/default/original/2X/6/61caef584737883d2b47805b88e5a7dd02fe81dd.png)

-\>

![Bildschirmfoto 2020-08-31 um 11.27.29](https://forum.xojo.com/uploads/default/original/2X/5/50c2f50c35cdce53248cc51eeefd6ab51d7a3a46.png)

Wow, that is cool!

---

<div class="post-metadata">

**Author:** ![Jean-Yves\_Pochez](https://forum.xojo.com/user_avatar/forum.xojo.com/jean-yves_pochez/32/21769_2.png) [@Jean-Yves\_Pochez](https://forum.xojo.com/u/Jean-Yves_Pochez)\
**Post date:** [August 31, 2020, 9:39am UTC](https://forum.xojo.com/t/web-2-0-api-getting-data-from-javascript/56490/14 "2020-08-31T09:39:25Z")

</div>

> [@Lars\_Lehmann](#):
>
> Wow, that is cool!

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

---

<div class="post-metadata">

**Author:** ![Greg\_O\_Lone](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o_lone/32/49_2.png) [@Greg\_O\_Lone](https://forum.xojo.com/u/Greg_O_Lone)\
**Post date:** [August 31, 2020, 10:47am UTC](https://forum.xojo.com/t/web-2-0-api-getting-data-from-javascript/56490/15 "2020-08-31T10:47:20Z")

</div>

> [@Michel\_Bujardet](#):
>
> It is really unfortunate that zero documentation or examples are provided yet.

There are several examples in Examples \> Web \> WebSDK.

---

<div class="post-metadata">

**Author:** ![Greg\_O\_Lone](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o_lone/32/49_2.png) [@Greg\_O\_Lone](https://forum.xojo.com/u/Greg_O_Lone)\
**Post date:** [August 31, 2020, 10:50am UTC](https://forum.xojo.com/t/web-2-0-api-getting-data-from-javascript/56490/16 "2020-08-31T10:50:34Z")

</div>

It’ll get there.

---

<div class="post-metadata">

**Author:** ![Thorsten\_Stueker](https://forum.xojo.com/user_avatar/forum.xojo.com/thorsten_stueker/32/1165_2.png) [@Thorsten\_Stueker](https://forum.xojo.com/u/Thorsten_Stueker)\
**Post date:** [August 31, 2020, 11:06am UTC](https://forum.xojo.com/t/web-2-0-api-getting-data-from-javascript/56490/17 "2020-08-31T11:06:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Greg\_O\_Lone](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o_lone/32/49_2.png) [@Greg\_O\_Lone](https://forum.xojo.com/u/Greg_O_Lone)\
**Post date:** [August 31, 2020, 11:19am UTC](https://forum.xojo.com/t/web-2-0-api-getting-data-from-javascript/56490/18 "2020-08-31T11:19:12Z")

</div>

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:

```
CallSomeMethodThatSendsJavascriptFromTheBrowser()

```

…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.

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [August 31, 2020, 12:49pm UTC](https://forum.xojo.com/t/web-2-0-api-getting-data-from-javascript/56490/19 "2020-08-31T12:49:12Z")

</div>

> [@Greg\_O\_Lone](#):
>
> There are several examples in Examples \> Web \> WebSDK.

I was looking in Extras. Old habits die hard 😉

Thank you, Greg

---

<div class="post-metadata">

**Author:** ![Lars\_Lehmann](https://forum.xojo.com/user_avatar/forum.xojo.com/lars_lehmann/32/11818_2.png) [@Lars\_Lehmann](https://forum.xojo.com/u/Lars_Lehmann)\
**Post date:** [August 31, 2020, 12:58pm UTC](https://forum.xojo.com/t/web-2-0-api-getting-data-from-javascript/56490/20 "2020-08-31T12:58:31Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Greg\_O\_Lone](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o_lone/32/49_2.png) [@Greg\_O\_Lone](https://forum.xojo.com/u/Greg_O_Lone)\
**Post date:** [August 31, 2020, 1:11pm UTC](https://forum.xojo.com/t/web-2-0-api-getting-data-from-javascript/56490/21 "2020-08-31T13:11:20Z")

</div>

Send along a JSON string that tells you.

[Next page](https://forum.xojo.com/t/web-2-0-api-getting-data-from-javascript/56490.md?page=2)
