🌐 AI搜索 & 代理 主页
Skip to content

Commit c93a8b5

Browse files
authored
Merge pull request corejavascript#130 from cpius/patch-1
Add documentation for the transport option
2 parents e7c5b72 + 9c5fa9b commit c93a8b5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

doc/bloodhound.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,17 @@ When configuring `remote`, the following options are available.
297297
you to transform the remote response before the Bloodhound instance operates
298298
on it. Defaults to the [identity function].
299299

300+
* `transport` – A function with the signature `transport(options, onSuccess, onError)`
301+
that allows you to specify a custom transport:
302+
```javascript
303+
transport: function (options, onSuccess, onError) {
304+
// Modify the options or replace the next line
305+
$.ajax(options)
306+
.done(function(data, textStatus, request) { onSuccess(data); })
307+
.fail(function(request, textStatus, errorThrown) { onError(errorThrown); });
308+
}
309+
```
310+
300311
<!-- section links -->
301312

302313
[identity function]: http://en.wikipedia.org/wiki/Identity_function

0 commit comments

Comments
 (0)