Skip Navigation

[Resolved] retrive toolset data in JS

This support ticket is created 3 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 3 years, 6 months ago.

Assisted by: Waqar.

Author
Posts
#2066191

Hi,

I would like to retrieve toolset field data into JS so I can write the code based on it.

Example, to send data from JS to toolset field, we used document.querySelector('input[name="wpcf-expiration-date"]').value = day2;

But How can we retrieve data from the toolset fields stored in the Database into JS?

#2066269

Hi,

Thank you for contacting us and I'd be happy to assist.

To retrieve data from Toolset Fields, you have these options:

1. Types Fields API:

You can use Toolset Types API shortcode or PHP function to get the fields data:
https://toolset.com/documentation/customizing-sites-using-php/functions/

Once you have the needed data, you can use it in your JS code.

2. If you're using the WordPress Rest API, you can also get the Toolset Fields data through it, as explained here:
https://toolset.com/documentation/programmer-reference/toolset-integration-with-the-rest-api/

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar