> For the complete documentation index, see [llms.txt](https://simcycreative.gitbook.io/signer/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://simcycreative.gitbook.io/signer/interaction-functions/helper-functions/server-responses.md).

# Server Responses

Simcify has a function that handles server responses. The function can still be called even if the response is not from the server as long as the correct JSON format is passed.

below are the expected response from server for this function;

{% hint style="info" %}
Response should be in JSON format only.
{% endhint %}

## Usage

Here is sample usage;

```javascript
serverResponse({
    "status":"success",
    "title":"Changes saved!",
    "message":"Your changes have been saved successfully.",
    "notify": true,
    "notifyType":"swal",
    "callback":"reload()",
    "callbackTime":"onconfirm",
    "showCancelButton": true,
    "buttonText": "View Changes"
});
```

### Response Explanation

| item             | Required | Type          | Description                                                                                |
| ---------------- | -------- | ------------- | ------------------------------------------------------------------------------------------ |
| status           | Yes      | **`string`**  | *warning* \| *success* \| *info* \| *error* (*info* is default).                           |
| title            | Yes\|No  | **`string`**  | Response title. *(required if* ***notify*** *is true and* ***notifyType*** *is toastr).*   |
| message          | Yes\|No  | **`string`**  | Response message. *(required if* ***notify*** *is true and* ***notifyType*** *is toastr).* |
| notify           | No       | **`boolean`** | whether to notify user on complete, default is *true.*                                     |
| notifyType       | No       | **`string`**  | use "swal" or "toastr", default is "swal".                                                 |
| callback         | No       | **`string`**  | callback function.                                                                         |
| callbackTime     | No       | **`string`**  | "instant" or "onconfirm", if notifyType is toastr, callbackTime must be instant.           |
| showCancelButton | No       | **`boolean`** | only added when notifyType is swal.                                                        |
| buttonText       | No       | **`string`**  | label of confirm button, only added when notifyType is swal.                               |
