How can I load a JSON file in the Webflow Custom Code section, and where should I place or write a new PHP file to display Jobvite data?

TL;DR
  • Host JSON externally and use JavaScript in Webflow's Custom Code section to fetch data.
  • Use an external server to run PHP, and fetch data with JavaScript via AJAX for display on Webflow.

Loading a JSON file and using PHP can be crucial for extended functionalities in Webflow, but there are specific steps and limitations to be aware of.

1. Loading a JSON File in Webflow

  • Webflow does not natively support uploading JSON files directly. 
  • You can host your JSON file on an external server or a service like GitHub or Google Cloud.
  • Use JavaScript in the Custom Code section of your Webflow project to fetch this data. Place this code within the Before Body Tag section:
    • Example (inside <script> tags): fetch('https://your-url.com/data.json').then(response => response.json()).then(data => console.log(data));
  • Replace 'https://your-url.com/data.json' with the URL of your hosted JSON file.

2. Using PHP to Display Jobvite Data

  • Webflow is a no-code platform and does not support PHP directly.
  • You will need an external server where PHP is functioning, such as a traditional hosting or a cloud service like AWS or Heroku.
  • Host your PHP script on your external server.
  • To display the data on your Webflow site, consider using an HTML Embed or Custom Code section:
    • Implement JavaScript to fetch data from your PHP endpoint (e.g., via an AJAX call).
    • For example, use fetch('https://your-server.com/jobvite.php').then(response => response.text()).then(html => document.querySelector('#target-div').innerHTML = html);
    • Ensure that your server handles CORS if you plan on fetching data client-side directly.

Summary

Webflow does not directly support JSON or PHP; you need external hosting for these files. Use JavaScript in Webflow's Custom Code section to fetch and display data from hosted JSON files or PHP scripts hosted on another server.

Rate this answer

Other Webflow Questions