seevaa.net

  • 본문 바로가기
  • 블로그 내 검색
  • 글 분류 목록
  • 최근 글 목록
  • 기타 블로그메뉴
  • about
  • photolog
  • socialpage
  • taglog
  • guestbook
  • admin

XMLHttpRequest Object

from Web Standard/JavaScript 2011. 5. 15. 17:05 by seevaa Share on Twitter*

Create an XMLHttpRequest Object

All modern browsers (IE7+, Firefox, Chrome, Safari, and Opera) have a built-in XMLHttpRequest object.

Syntax for creating an XMLHttpRequest object:

xmlhttp=new XMLHttpRequest();

Old versions of Internet Explorer (IE5 and IE6) uses an ActiveX Object:

xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

To handle all modern browsers, including IE5 and IE6, check if the browser supports the XMLHttpRequest object. If it does, create an XMLHttpRequest object, if not, create an ActiveXObject:

Example

if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
}
else {// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}

Send a Request To a Server

To send a request to a server, we use the open() and send() methods of the XMLHttpRequest object:

  • open(method,url,async) : Specifies the type of request, the URL, and if the request should be handled asynchronously or not.
    • method: the type of request: GET or POST
    • url: the location of the file on the server
    • async: true (asynchronous) or false (synchronous)
    xmlhttp.open("GET","xmlhttp_info.txt",true);
  • send(string) : Sends the request off to the server.
    • string: Only used for POST requests
    xmlhttp.send();

'Web Standard > JavaScript' 카테고리의 다른 글

정규식 표현으로 필드값 검사하기  (0) 2011.10.11
Basic Filter for Index  (1) 2011.04.18
grayscale  (3) 2011.03.23
,

Categories

  • All (316)
    • Life Style (102)
    • Images (94)
      • Photo (94)
    • Web Standard (11)
      • HTML (0)
      • CSS (4)
      • JavaScript (7)
    • Application Programing (8)
      • java/jsp (8)
    • DataBase (5)
      • Oracle (3)
      • MySQL (0)
    • Programing Tool (2)
      • Eclipse (2)
    • Tistory (50)
      • Skin (22)
    • Fonts (12)
    • Bookmarks (31)

Recent Posts

Recent Comments

Recent Trackbacks

Archive

Links

  • http://wing91.tistory.com
  • http://xylosper.net
  • http://hanrss.co.kr
  • http://poty.cafe24.com
  • http://standardmag.org
  • http://www.raysoda.com/ess
  • http://startuu.net
  • http://cyoonk.com
  • http://trio.co.kr/webrefer/css…
  • http://designsen.net
  • http://tipography.tistory.com
  • http://twitter.com/seevaa_
  • http://tum.seevaa.net
  • http://clip.seevaa.net
subscribe to RSS

T Y T
subscribe to RSS, valid XHTML, CSS
Powered by , Designed by seevaa

  • 처음으로
  • 본문 바로가기
  • 블로그 내 검색
  • 글 분류 목록
  • 최근 글 목록
  • 기타 블로그메뉴
seevaa.net - XMLHttpRequest Object
작성자 : 쎄바(seevaa)
연락처 : seevaa@seevaa.net

티스토리툴바