Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixes

  • Loading branch information...
commit ac9669dcd688bec67c57f471d2fc2b13a09f829c 1 parent 0b94915
@spockz spockz authored
View
22 uhc-jscript/src/Language/UHC/JScript/JQuery/Ajax.hs
@@ -1,34 +1,38 @@
module Language.UHC.JScript.JQuery.Ajax (AjaxOptions(..), JSAjaxOptions(..), ajax, toJSOptions) where
import Language.UHC.JScript.ECMA.String
--- import Language.UHC.JScript.Types
+import Language.UHC.JScript.Types
import Language.UHC.JScript.Primitives
+import Data.List
-toJS :: String -> JSString
-toJS = stringToJSString
data AjaxOptions a = AjaxOptions {
ao_url :: String,
ao_requestType :: String,
ao_contentType :: String,
ao_dataType :: String,
- ao_success :: JSFunPtr (a -> IO()),
- ao_failure :: JSFunPtr (a -> IO())
-
+ ao_success :: JSFunPtr (JSPtr a -> IO()),
+ ao_failure :: JSFunPtr (JSPtr a -> IO())
}
+
data JSAjaxOptions a = JSAjaxOptions {
jsao_url :: JSString,
jsao_requestType :: JSString,
jsao_contentType :: JSString,
jsao_dataType :: JSString,
- jsao_success :: JSFunPtr (a -> IO()),
- jsao_failure :: JSFunPtr (a -> IO())
-
+ jsao_success :: JSFunPtr (JSPtr a -> IO()),
+ jsao_failure :: JSFunPtr (JSPtr a -> IO())
}
+instance Show (AjaxOptions a) where
+ show jsopt= "AjaxOptions: " ++ intercalate " " [show $ ao_url jsopt]
+
+instance Show (JSAjaxOptions a) where
+ show jsopt = "JSAjaxOptions: " ++ intercalate " " [show $ jsao_url jsopt]
+
toJSOptions :: AjaxOptions a -> JSAjaxOptions a
toJSOptions options = let url' = toJS (ao_url options)
requestType' = toJS (ao_requestType options)
View
18 uhc-jscript/src/Language/UHC/JScript/JQuery/AjaxQueue.hs
@@ -4,11 +4,23 @@ import Language.UHC.JScript.Primitives
import Language.UHC.JScript.Types
import Language.UHC.JScript.ECMA.String
-import Language.UHC.JScript.JQuery.Ajax
+import Language.UHC.JScript.JQuery.Ajax
+
+import Language.UHC.JScript.Assorted (alert, _alert)
ajaxQ :: String -> AjaxOptions a -> IO ()
-ajaxQ queuename options = do o <- mkObj (toJSOptions options)
- _ajaxQ (toJS queuename) o
+ajaxQ queuename options = do alert (show $ options)
+ alert (ao_url options)
+ _alert (toJS $ ao_url options)
+ _alert $ toJS (ao_requestType options)
+ _alert $ toJS (ao_contentType options)
+ _alert $ toJS (ao_dataType options)
+ -- let foo = toJSOptions options
+ -- _alert $ jsao_url foo
+ -- alert (show $ toJSOptions options)
+ o <- mkObj (toJSOptions options)
+ return ()
+ -- _ajaxQ (toJS queuename) o
foreign import jscript "$.ajaxq(%*)"
_ajaxQ :: JSString -> JSPtr a -> IO ()
Please sign in to comment.
Something went wrong with that request. Please try again.