Commit 2602991d authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files

putting the 'A' back in AJAX

parent 16422b16
......@@ -142,16 +142,23 @@ function sendjsonrequest(script, data, rtype, successcallback, errorcallback, qu
}
processingStart();
data.sesskey = config.sesskey;
var req = getXMLHttpRequest();
if (rtype = 'GET') {
req.open('GET', script + '?' + queryString(data));
var d = sendXMLHttpRequest(req);
}
else {
req.open('POST', script);
req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
var d = sendXMLHttpRequest(req, queryString(data));
rtype = rtype.toLowerCase();
var xhrOptions = { 'method': rtype };
switch (rtype) {
case 'post':
xhrOptions.headers = { 'Content-type': 'application/x-www-form-urlencoded' };
xhrOptions.sendContent = MochiKit.Base.queryString(data);
break;
default:
xhrOptions.queryString = data;
break;
}
var d = doXHR(script, xhrOptions);
d.addCallbacks(function (result) {
var data = evalJSONRequest(result);
var errtype = false;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment