> For the complete documentation index, see [llms.txt](https://kb.moomoo.agency/uni-cpo-4-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kb.moomoo.agency/uni-cpo-4-documentation/for-developers/js-events.md).

# JS events

**We use jQuery and its '.trigger' function to fire events. Therefore, those events are available only when you use jQuery as well.**

Event `uni_cpo_options_data_ajax_before_send`

�Contains form data just before sending request to backend.

Event `uni_cpo_options_data_ajax_success`

�Is fired if ajax request was successful. Contains both form data and response data.

Event `uni_cpo_options_data_ajax_fail`

�Is fired when ajax request was not successful. Contains both form data and response data.

Event `uni_cpo_set_price_event`

This event is fired when the price has just been updated after price calculation is made. It receives a string value of the updated price.

Event `uni_cpo_set_btn_state_event`

Fires when price calculation has just been made and holds the value of the 'add to cart' button. It can be either `true` or `false`.

Class `uni_add_to_cart`

�This class is added to 'add to cart' button and is used to add add to cart via ajax functionality. You can add this class to your custom button(s) and achieve the same effect.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://kb.moomoo.agency/uni-cpo-4-documentation/for-developers/js-events.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
