Plugins: How to Render a View (AJAX)
-
I am using the wordpress plugin boiler plate by Tom McFarlin (https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate)
I have a view that has a dropdown where the selection will create another dropdown based off the selection. For example:
The first dropdown is a list of producers. When a user selects a producer, another dropdown will appear with a list of products by that producer.
In the class-Plugin-Name.php file, I have a function which echos the html of the new dropdown. WordPress gives me this error:
Warning: Cannot modify header information – headers already sent by (output started at /path/to/mysite/wordpress/wp-content/plugins/my-plugin-name/public/class-plugin_name.php:400) in /path/to/mysite/wordpress/wp-includes/pluggable.php on line 1121
Clearly, wordpress does not like me echoing html form this file. But since it’s with AJAX (which im still learning), Im not quite sure how wordpress wants it. The html appears in the right spot, just with a glaring error message under it.
Any ideas? Also, please let me know if you need any clarifications.
- The topic ‘Plugins: How to Render a View (AJAX)’ is closed to new replies.