Permalink
Browse files

* Added param for passing data trough the request

  • Loading branch information...
1 parent 5cdfed7 commit b52b24d61d16f2aa2000d34e86e1779704c7e51d @spockz spockz committed Jan 6, 2012
@@ -52,18 +52,19 @@ toJSOptions options = let url' = toJS (ao_url options)
}
-ajaxBackend :: JS r => (JSPtr a -> IO ()) -> AjaxOptions a -> AjaxCallback r -> AjaxCallback r -> IO ()
-ajaxBackend cont options onSuccess onFailure =
+ajaxBackend :: JS r => (JSPtr a -> IO ()) -> AjaxOptions a -> JSPtr b -> AjaxCallback r -> AjaxCallback r -> IO ()
+ajaxBackend cont options valdata onSuccess onFailure =
do let jsOptions = toJSOptions options
onSuccess' <- mkJSAjaxCallback onSuccess
onFailure' <- mkJSAjaxCallback onFailure
o <- mkObj jsOptions
_ <- setAttr "type" (requestType jsOptions) o
_ <- setAttr "success" onSuccess' o
- _ <- setAttr "error" onFailure' o
+ _ <- setAttr "error" onFailure' o
+ _ <- setAttr "data" valdata o
_ajaxQ (toJS "jcu_app") o
-ajax :: JS r => AjaxOptions a -> AjaxCallback r -> AjaxCallback r -> IO ()
+ajax :: JS r => AjaxOptions a -> JSPtr b -> AjaxCallback r -> AjaxCallback r -> IO ()
ajax = ajaxBackend _ajax
@@ -8,7 +8,7 @@ import Language.UHC.JScript.JQuery.Ajax
import Language.UHC.JScript.Assorted (alert, _alert)
-ajaxQ :: JS r => String -> AjaxOptions a -> AjaxCallback r -> AjaxCallback r -> IO ()
+ajaxQ :: JS r => String -> AjaxOptions a -> JSPtr b -> AjaxCallback r -> AjaxCallback r -> IO ()
ajaxQ queuename = ajaxBackend (_ajaxQ $ toJS queuename)
foreign import jscript "$.ajaxq(%*)"

0 comments on commit b52b24d

Please sign in to comment.