}
}
};
MochiKit.Base.update(MochiKit.Async, {
evalJSONRequest: function (/* req */) {
/***
Evaluate a JSON (JavaScript Object Notation) XMLHttpRequest
@param re
ndXMLHttpRequest(req);
},
loadJSONDoc: function (url) {
/***
Do a simple XMLHttpRequest to a URL and get the response
as a JSON document.
@param url: The URL
the evaluated JSON response
***/
var self = MochiKit.Async;
var d = self.doSimpleXMLHttpRequest.apply(self, arguments);
d = d.addCallback(self.evalJSONRequest);
eturn o + "";
},
registerJSON: function (name, check, wrap, /* optional */override) {
/***
Register a JSON serialization function. JSON serialization
functio
ns should take one argument and return an object
suitable for JSON serialization:
- string
- number
- boolean
- undefined
- obj
- Array-like (length property that is a number)
- Objects with a "json" method will have this method called
- Any other object will be used as {key:valu