AJAX (tag)

check_ajax_referer()

Verifies nonce token of an Ajax request. Kills PHP if the verification failed. By default searches for a nonce token in $_REQUEST['_ajax_nonce'] and $_REQUEST['_wpnonce'].

wp_doing_ajax()

Determines whether the current request is a WordPress Ajax request.

wp_json_encode()

Encode a variable into JSON, with some sanity checks. Checks strings and translates them to UTF-8.

wp_send_json()

Encodes the passed variable into JSON, prints the result to the screen and terminates the script (die). Used to return data for AJAX requests.

wp_send_json_error()

Send a JSON response back to an Ajax request, indicating failure.

wp_send_json_success()

Returns JSON data. Is used to return a success response to AJAX request. The response object always contains the element success=true. die() php execution.