webCOMAND

ajax::include_all()

Include the following AJAX key/value pairs when an ok() and error() response is sent.

  • Result - "OK" on ok(), "ERROR" on error().
  • Message - Message set with ajax->Message = 'example message' or ajax->set('message', 'example message').
  • Timestamp - Timestamp from when ok() or error() was called.
  • Data - Any data passed to ok() or error().
The second parameter passed to ajax::ok() and ajax::error() can be set to TRUE instead of calling this method.

Prototype

void include_all()

Example

// send AJAX response with JSON like:
// {"Result":"OK", "Timestamp":"2018-04-12 10:53:07", "Message":"Success"}
$ajax = new \io_comand_web\ajax();
$ajax->include_all();
$ajax->ok('Success');