Pass data from bubble into JavaScript

I’m using the Toolbox plugin to fix the formatting of some bad JSON.

I need to take the bad JSON (which is in my database) and run a simple JavaScript function on it (which I already have built).

I have everything completely built, except my JavaScript has var bad_json = ? because I can’t figure out how to get the data into Javascript.

By the way, I can’t usedocument.getElementById("my_id"), since this is a RG, that breaks since there’s more than one element with the same ID.


Check out this example from the toolbox examples, it will show you how to use the toolbox element in a RG. toolbox-example | Bubble Editor

Let me know if you have any questions on it.

I am having a hard time seeing how to pass any data from into Javascript with that.

The more I look at that example, I think it’s just making two RGs have corresponding values. But nowhere is any Bubble data being passed into Javascript.

Did you see these bits?

Yes I did.

I don’t need to have a function named a certain way in my JavaScript, I need to have the value of a variable come from the Bubble database.

Alright, I’ll track down a different example, you can input data directly to the toolbox using a run javascript function, give me a few minutes and I’ll find the example (or setup a new one).

1 Like

This one is done using the expression element, will that work?

Ahhh!! I just noticed there’s a “Insert Dynamic Data” popup directly in the JavaScript field!

I can just easily insert any kind of Bubble data directly into the Javascript. Very cool, and super easy.


This topic was automatically closed after 70 days. New replies are no longer allowed.