2 function WebForm_DoCallback (id, arg, callback, ctx, errorCallback)
4 var qs = WebForm_getFormData () + "&__CALLBACKTARGET=" + id + "&&__CALLBACKARGUMENT=" + escape(arg);
5 WebForm_httpPost (document.URL, qs, function (httpPost) { WebForm_ClientCallback (httpPost, ctx, callback, errorCallback); });
8 function WebForm_ClientCallback (httpPost, ctx, callback, errorCallback)
11 var doc = httpPost.responseText;
13 if (errorCallback != null)
14 errorCallback (httpPost.responseText, ctx);
20 function WebForm_getFormData ()
23 var len = theForm.elements.length;
24 for (n=0; n<len; n++) {
25 var elem = theForm.elements [n];
26 if (qs.length > 0) qs += "&";
27 qs += elem.name + "=" + escape (elem.value);
33 function WebForm_httpPost (url, data, callback)
37 if (typeof XMLHttpRequest != "undefined") {
38 httpPost = new XMLHttpRequest ();
39 httpPost.addEventListener ("load", function () { callback (httpPost);}, false );
42 httpPost = new ActiveXObject (axName);
44 var clsnames = new Array ("MSXML", "MSXML2", "MSXML3", "Microsoft");
45 for (n = 0; n < clsnames.length && httpPost == null; n++) {
46 axName = clsnames [n] + ".XMLHTTP";
48 httpPost = new ActiveXObject (axName);
49 } catch (e) { axName = null; }
52 throw new Error ("XMLHTTP object could not be created.");
54 httpPost.onreadystatechange = function () { if (httpPost.readyState == 4) callback (httpPost); };
57 httpPost.open ("POST", url, true); // async
58 httpPost.setRequestHeader ("Content-Type", "application/x-www-form-urlencoded");
59 setTimeout (function () { httpPost.send (data); }, 10);