I already use mochikit at some webware (python) projects, now I'm
learning turbogears and I see a code to post json to another page, a
function called postJSON:
var postJSON = function(url, postVars) {
var req = getXMLHttpRequest();
req.open("POST", url, true);
req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
var data = queryString(postVars);
var d = sendXMLHttpRequest(req, data);
return d.addCallback(evalJSONRequest);
}
What about including this function in mochikit?
Thanks!
--
Michel Thadeu Sabchuk
Curitiba - Brasil
> What about including this function in mochikit?
Check the archives and you'll see a lot of discussion about that. Specially
the explanations on why there isn't any standard function at the library.
--
Jorge Godoy <jgo...@gmail.com>
First of all, postJSON is a very bad name for a function that posts
URL encoded variables.. but second, the trunk has a doXHR function
that lets you do all of that stuff (except the evalJSONRequest) in one
function call. It's still a lot of typing, but for whatever reason
people feel more comfortable with one long function call instead of
three equivalent lines, so it's available.
-bob