The JSON Content Importer Plugins are connecting APIs, converting the retrieved JSON and show it on a static WordPress-Page. Usually you have to reload the whole page to get the new API-data.
If this is not enough as you want to update the data without reloading we can do this with AJAX. The WordPress-Plugin “Auto Refresh API AJAX” can do that (Download Beta-Version here):
- Define the URL with the JSON-data
Example: http://api.json-content-importer.com/extra/auto-refresh-api-ajax/1.php has the current time as JSON-data. If there is a problem, you might switch from WP-Admin-AJax to WP-Rest-API.
- Define the refreshtime in Milliseconds:
1000 Milliseconds means that the above JSON-feed is connected every second
- Define what value in the JSON should be displayed and refreshed: JSON-Path to Value
In the above example this is “items.0.currentdate”
- Define where on a page the data should be displayed: DOM-Pageselector
Example: Create a new WordPress-page and insert in the TEXT-editor this:
<div id=”showtime”>one moment – data is loading</div>
Then you define this DOM-Selector: div[id=”showtime”]
See it in action: