# Handle return data

## Syntax

```
$.response = function (data, callback)
```

## Arguments

&#x20;

<table data-header-hidden><thead><tr><th width="125">Argument</th><th width="118">Data Type</th><th width="382">Description</th><th>Default Value</th></tr></thead><tbody><tr><td><em>data</em></td><td>object</td><td>Data received from server.</td><td> </td></tr><tr><td><em>callback</em></td><td>function</td><td><p>Contains calls of JavaScript functions that should be executed in series if received data is not erroneous.</p><p> </p></td><td> </td></tr></tbody></table>

## Description

It evaluates return data from the server whether it contains an error or not. If it contains no error, callback function will be executed, else it will not be executed.

## Example

The following program illustrates the function call where a Json String is passed as object for the parameter “data”:

&#x20;

```
Server:
        public ActionResult Example(string id)
        {
            var model = new ExampleViewModel();
            model.Test(id);
            return Json(new { succeed = true }, JsonRequestBehavior.AllowGet);
        }

Client:
    	 function onTestSuccess(data) { 
            $.response(data, function () { alert(data); }) 
    	 }

```

The Server returns a Json String. After Client receives the Json String, it forwards it as input for the parameter “data” to the “$.response” function which evaluates it. If the passed Json String contains no error, the “alert” function will output it on the screen.


---

# Agent Instructions: 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:

```
GET https://aeudoc.gitbook.io/developer/presentation/client-script/handle-return-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
