faylang/fay-jquery

AJAX API needs implementation

bgamari opened this issue · 2 comments

In my opinion, jQuery's AJAX interface is one of the more useful facets of the library. Bindings to this part of the library would be very nice. I'm opening this issue to provide a place to track this work.

I have experimented with this a bit and have two branches with (partial) solutions. The first one is to define an AjaxSettings record which defines everything $.ajax can handle that may be useful and then only provide ajax :: AjaxSettings -> Fay () and perhaps some sugared helper functions for this. The second one is to declare ffi functions for a few commonly used ways of calling $.ajax, such as sendRecord, fetchRecord, ... The first one is doable with the recent introduction of Nullable and Defined in Fay, it needs some FFI hackery to get around reserved haskell words and such but it should work, and it's more flexible. I can push these later if you want to take a look.

I pushed this to master, try it out and see if it works and if anything can be improved!