Skip to content

Commit

Permalink
add mimetype-converter support to ajax request
Browse files Browse the repository at this point in the history
  • Loading branch information
mpenet committed Sep 18, 2012
1 parent 3a77c75 commit b836d14
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/jayq/core.cljs
@@ -1,6 +1,7 @@
(ns jayq.core
(:refer-clojure :exclude [val empty remove find])
(:require [clojure.string :as string])
(:require [clojure.string :as string]
[cljs.reader :as reader])
(:use [jayq.util :only [clj->js]]))

(defn crate-meta [func]
Expand Down Expand Up @@ -195,6 +196,17 @@
([settings]
(.ajax js/jQuery (clj->js settings))))

(defn ^:private mimetype-converter [s]
(reader/read-string (str s)))

(.ajaxSetup js/jQuery
(clj->js
{:contents {"clj" #"edn|clj"}
:converters
{"text edn" mimetype-converter
"text clj" mimetype-converter}}))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Events
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Expand Down

0 comments on commit b836d14

Please sign in to comment.