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?
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