@@ -46,6 +46,23 @@ module Reflex.Dom.Xhr
4646 --
4747 -- 3. Consume the resulting stream of 'XhrResponse' events,
4848 -- parsing the body of the response however appropriate.
49+ --
50+ -- Here is an example of calling a search API whenever the user
51+ -- types in a text input field and printing the result on the page:
52+ --
53+ -- @
54+ -- url query = "http://example.com/search?query=" <> query
55+ --
56+ -- search queries = do
57+ -- responses <- performRequestAsync $ toRequest <$> queries
58+ -- return $ view xhrResponse_responseText <$> responses
59+ -- where toRequest query = XhrRequest "GET" (url query) def
60+ --
61+ -- main = mainWidget $ do
62+ -- queries <- textInput def
63+ -- results <- search queries
64+ -- dynText $ holdDyn "No results." results
65+ -- @
4966
5067 -- ** XHR Requests
5168 , XhrRequest (..)