출처 : http://www.xul.fr/en-xml-ajax.html


The XMLHttpRequest class

Attributes

readyState the code successively changes value from 0 to 4 that means for "ready".
status 200 is ok
404 if the page is not found.
responseText holds loaded data as a string of characters.
responseXml holds a Xml loaded file, DOM's method allows to extract data.
onreadystatechange onreadystatechange


Methods

open(mode, url, boolean) mode: type of request, GET or POST
url: the location of the file, with a path.
boolean: true (asynchronous) / false (synchrous).
optionally, a login and a password may be added to arguments.
send("string") null for a GET command.



create an instance


if (window.XMLHttpRequest)     // Object of the current windows
{
       request = new XMLHttpRequest();     // Firefox, Safari, ...
}
else
if (window.ActiveXObject)   // ActiveX version
{
      request = new ActiveXObject("Microsoft.XMLHTTP");   // Internet Explorer
}


wait for the response

request.onreadystatechange = function() { // instructions to process the response };

if (request.readyState == 4)
{
   // received, OK
} else
{
// wait...
}

make the request itself

http_request.open('GET', 'http://www.xul.fr/somefile.xml', true);
http_request.send(null);

2007/01/18 13:33 2007/01/18 13:33

Trackback Address :: http://www.blackball.pe.kr/trackback/8

Comment on this post!

[로그인][오픈아이디란?]
오픈아이디로만 댓글을 남길 수 있습니다