нет, не пошло
Я даю код програмы. Возвожно у меня там штото не так.
| Код |
function sendRequest(to, type, text){ text = to + '?' + text; var oRequest = getRequestObject(); oRequest.open(type, text, true, this.User, this.Password); if (type == "POST"){ try { oRequest.setRequestHeader("Method", "POST " + text + " HTTP/1.1"); oRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); } catch(e){ alert("You brouser dot's support POST metod"); return false; } } oRequest.onreadystatechange = function(){ if (oRequest.readyState != 4) return; if(oRequest.status == 200){ oAjax.Text = oRequest.responseText; if(oRequest.responseXML.documentElement && oRequest.responseXML){ oAjax.XML = XMLHTTPRequest.responseXML; }else{ oAjax.XML = null; } oAjax.OnSend(oAjax.Text, oAjax.XML); }else { alert("Error retrieving data!"); } delete oRequest; oRequest = null; oAjax.OnSendEnd(); } this.OnSendBegin(); oRequest.send(text); if (oRequest){ delete oRequest; }
}
function Ajax(){ this.SendTo = sendRequest; this.QSend = null this.Send = null; this.Add = null; this.OnSendBegin = function(){}; this.OnSend = function(text, xml){}; this.OnSendEnd = function(){}; this.Type = "POST"; this.URL = ''; this.User = ''; this.Password = ''; this.SendText = ''; this.Text = ''; this.XML = null; this.QSend = function(field, value){ var text = field + '=' + encodeURIComponent(value); this.SendTo(this.URL, this.Type , text); } this.Send = function(){ this.SendTo(this.URL, this.Type , this.SendText); this.SendText = ''; } this.Add = function(field, value){ if(this.SendText == ''){ this.SendText = field + '=' + encodeURIComponent(value); }else{ this.SendText = this.SendText + '&' + field + '=' + encodeURIComponent(value); } } } oAjax = new Ajax;
|
|