Can I use a View in my JS code, by adding the View's shortcode where the JS expects some results?
The View returns the results the code expects.
Generally, ShortCodes can not be added to JS.
You could add the JS within script tags to your HTML section of a content Template for example.
Then you could apply this custom code here to retrieve a "raw" Views' loop result.
This can then eventually be used to populate your Custom JS.
This is however not suggetsed, n or supported.
It is a full custom solution - and not agreeing with Toolset Views' major purpose, which is to display - not deliver data.
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.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | - | 14:00 – 20:00 | 14:00 – 20:00 | 14:00 – 20:00 | 14:00 – 20:00 | 14:00 – 20:00 |
- | - | - | - | - | - | - |
Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)
This topic contains 4 replies, has 2 voices.
Last updated by 6 years, 8 months ago.
Assisted by: Beda.