PHP

Functions

setcookie()

WordPress

Functions

wp_send_json() wp_send_json_success() wp_send_json_error()

Actions

[wp_ajax(action)](https://codex.wordpress.org/Plugin_API/Action_Reference/wp_ajax(action))

JavaScript

jQuery.ajax()

Best Practices

WordPress Widgets Validating Sanitizing and Escaping User Data AJAX in Plugins WordPress Nonces

Assignment

Create a plugin for a Widget that allows site visitors to adjust the colors and font size of your site. Store these preferences in a cookie for unlogged-in visitors, and in a user option for logged-in users. Use AJAX to communicate between the front-end Widget and WordPress to save the option or cookie. You can instruct the user to reload the page for their changes to take effect – bonus points if they don’t have to reload (this will involve more JavaScript).

Additional reading