This might be a super easy question but I am not sure as I am just not familiar with it.
I had a developer write some code I have running and on a button click, it runs the code and creates a “Global Variable” that I can access if I simply type in the variable in Google Console “design_data”
design_data is an object.
I am trying to figure out how to pass this into a wappler variable or bind the value to a wappler variable but cannot figure out how.
There is a button available to initialize global variables so they will be available in the picker. Select the top level component (App) and you’ll see the button for Global variables. Then you just select it like other dynamic bindings.
In the Set Values you can’t type “dmx.global(…)” nor “window.(…)”, just “designDataVar4”
Edit: Hold on, you can’t do stuff like that in a Server Action. A Server Action is a back-end thing, it doesn’t have access to variables you expose on the front-end.
The Set Values you do there are exposed on the JSON response of the Server Action calls
You would need to set those variables in the front-end, on Server Action success
So if you look at the JS code being ran downloadImage(callback)…
That is setting the variable designDataVar3
I am then able to see that in my browser console
The problem is I am unable to grab that value in a “server action”
I think I am just reitterating that point, but just wanted to be clear of what is happening
So I have been trying all sorts of ways (why you see a variety of different things) on how to access that. Unless I am simply setting the Global variable incorrectly on my downloadImage(callback) function
So do you even need to set a global variable? Do you want to use it in the server action only? If yes - why don’t you directly call the server action in your js code and pass the value to it?
I am passing an object with two base64 dataURLs for images (along with other json data) which is very big. When stringifying this it faults out with a CORS issue and gets super laggy.
My thoughts were if I could just grab the global variable then I could avoid this & the errors.
Are you sure you can’t pass it in a Server Connect Form, as an input field? The last screenshot you posted is passing the data as a query string, different from passing as a form field
(post the HTML code so I can see)
And if that doesn’t work, have you checked in the browser console if the string gets cut or if it’s another server error that happens?
I’m not really in the best days to do consultation work (broken sleep schedule and stuff like that), otherwise I’d really love to help you