Safe Haskell | None |
---|---|
Language | Haskell2010 |
Reflex.Dom.Contrib.Xhr
Description
Convenience functions for dealing with XMLHttpRequest.
- formEncode :: Map String ByteString -> String
- formEncodeJSON :: ToJSON a => a -> String
- toPost :: String -> String -> XhrRequest
- performAJAX :: MonadWidget t m => (a -> XhrRequest) -> (XhrResponse -> b) -> Event t a -> m (Event t (a, b))
- performJsonAjax :: (MonadWidget t m, ToJSON a, FromJSON b) => Event t (String, a) -> m (Event t (a, Maybe b))
Documentation
formEncode :: Map String ByteString -> String Source
URL encodes a map of key-value pairs.
formEncodeJSON :: ToJSON a => a -> String Source
Form encodes a JSON object.
Convenience function for constructing a POST request.
Arguments
:: MonadWidget t m | |
=> (a -> XhrRequest) | Function to build the request |
-> (XhrResponse -> b) | Function to parse the response |
-> Event t a | |
-> m (Event t (a, b)) |
This is the foundational primitive for the XHR API because it gives you full control over request generation and response parsing and also allows you to match things that generated the request with their corresponding responses.