|
@@ -57,7 +57,14 @@ headers: {
|
|
|
|
|
|
### `getResponseData(xhr)`
|
|
### `getResponseData(xhr)`
|
|
|
|
|
|
-When an upload has completed, Uppy will extract response data from the upload endpoint and send it back in the `upload-success` event.
|
|
|
|
|
|
+When an upload has completed, Uppy will extract response data from the upload endpoint and send it back in the `upload-success` event:
|
|
|
|
+
|
|
|
|
+```js
|
|
|
|
+uppy.on('upload-success', (fileId, resp, uploadURL) => {
|
|
|
|
+ // do something with resp
|
|
|
|
+})
|
|
|
|
+```
|
|
|
|
+
|
|
By default, Uppy assumes the endpoint will return JSON. So, if `POST /upload` responds with:
|
|
By default, Uppy assumes the endpoint will return JSON. So, if `POST /upload` responds with:
|
|
|
|
|
|
```json
|
|
```json
|
|
@@ -67,10 +74,7 @@ By default, Uppy assumes the endpoint will return JSON. So, if `POST /upload` re
|
|
}
|
|
}
|
|
```
|
|
```
|
|
|
|
|
|
-That object will be emitted in the `upload-success` event.
|
|
|
|
-
|
|
|
|
-Not all endpoints respond with JSON. Providing a `getResponseData` function overrides this behavior.
|
|
|
|
-The `xhr` parameter is the `XMLHttpRequest` instance used to upload the file.
|
|
|
|
|
|
+That object will be emitted in the `upload-success` event. Not all endpoints respond with JSON. Providing a `getResponseData` function overrides this behavior. The `xhr` parameter is the `XMLHttpRequest` instance used to upload the file.
|
|
|
|
|
|
For example, an endpoint that responds with an XML document:
|
|
For example, an endpoint that responds with an XML document:
|
|
|
|
|