Confetti Bits

AJAX

Table of Contents

Classes

CB_Ajax_Component
A component that helps organize our AJAX endpoints.

Functions

cb_ajax_register_rest_route()  : mixed
Dynamically registers a REST route.
cb_setup_ajax()  : mixed
Loads our AJAX component, so we can play nice with Javascript.
cb_ajax_get_transactions()  : JSON
CB AJAX Get Transactions
cb_ajax_new_transactions()  : mixed
CB AJAX New Transactions

Functions

cb_ajax_register_rest_route()

Dynamically registers a REST route.

cb_ajax_register_rest_route([string $component = '' ]) : mixed
Parameters
$component : string = ''

The component to register a route for.

Tags
since
2.3.0

cb_setup_ajax()

Loads our AJAX component, so we can play nice with Javascript.

cb_setup_ajax() : mixed
Tags
since
2.3.0

cb_ajax_get_transactions()

CB AJAX Get Transactions

cb_ajax_get_transactions() : JSON

Gets transactions for a user based on the user_id passed in the $_GET array.

Tags
since
2.3.0
Return values
JSON

{ 'text': JSON (JSON encoded array of transactions, or error message), 'type': string (success or error) }

cb_ajax_new_transactions()

CB AJAX New Transactions

cb_ajax_new_transactions() : mixed

AJAX handler for creating transactions.

All parameters are passed via POST request.

The following parameters are required:

  • sender_id (int) - The ID of the user sending the bits.
  • recipient_id (int) - The ID of the user receiving the bits.
  • amount (int) - The amount of bits to send.
  • log_entry (string) - The log entry to record for this transaction.
Tags
since
2.3.0

        
On this page

Search results