Set variables from javascript (object)

im in need to link my js code with app connect
i know about the hidden inputs way. but i dont want to use it since its not practical in m situation. (having 30+ inputs is absurd)
im using framework7 to build a mobile app and there is a lot of data i need to pass from my code to app connect. and vice versa, some are strings and some are objects.

how can i set a variable value from js? what function i need to call?

Thank you!

Please check the following topics, this topic has already been discussed in our community:

1 Like

kindly read my post.

also im not asking about getting the value. i want to set it.

@patrick could help with this if possible

Please provide a little more detailed information of what exactly are you trying to do.
What variable do you want to set? Where/how? Where the value comes form?
Some example will help.

i have multiple js objects user, stores, service each one have more than one property. that i get from a series of ajax calls (cant use app connect because i need to use js code here)
one of the object is something like this

user {name: myname, age:myage, token:mytoken, ....}

after i have them in my js code i want to pass them to app connect for future use

And where do you need to use them in App Connect?

on more than one place.
for example on API actions, or to set a value on inner text of a paragraph, etc

why would you need App Connect for that if you are using javascript for these values already - you can do this using pure js?

Also - how do you need to use these values in API Actions? Is this in the Server API Connector? Please be more specific so we can help you!

i only have these values on some parts of the app. after that app connect will handle the rest using these values.
i want to show, hide, assign values, toggle css class… to the page elements.
you know, do what app connect do.

for starter after i get the values from js i want to assign them to my page elements using app connect. then make further requests using the API actions.

in some places its impossible to use app connect alone. (phonegap plugins, sockets connections, framework7 virtual list…)

I understand you now, you can use:'user', user)

Which will make the user object available under i.e. directly available to be used in app connect as dmx-text="user.age"

1 Like