Ajax (Pro)
The Pro edition has the Custom_Data
feature for Views and Cards, which allows for highly customizing the components. Besides passing extra arguments mentioned in the linked guides, you can also add Ajax to your components.
This feature is built on top of the built-in WordPress Ajax feature and allows you to easily master Ajax functionality inside Views and Cards.
To use it, you just need to override the get_ajax_response()
method inside the Custom_Data
instance. The return should be an array, which will be passed as JSON to the client. Then, on the client, you need to request the admin-ajax.php
file with the advanced_views
action and pass the View or Card ID.
Inside the callback, you can use any WordPress functions. Furthermore, you can employ PHP-DI to get direct access to your theme classes.
Example of usage
script.js
view.php
card.php
Last updated