Ryan's District
November 22, 2008, 12:57:06 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: You are not allowed to view links.
Register or Login
How to Unlock Nokia mobile Phones

You are not allowed to view links.
Register or Login
Request any TV Show / series / Episodes / movie and we will get it for you for free

 
   Home   Help Search Chat Calendar Chess Shop Login Register  
Digg This!
Pages: [1]   Go Down
  Send this topic  |  Print  
Author Topic: Creating an XMLHttpRequest Object  (Read 5111 times)
0 Members and 1 Guest are viewing this topic.
ben2ong2
Quality Poster
Paid
Hero Member
*****

Reputation: 17
Offline Offline

Gender: Male
Posts: 2374
9976.80 RD$

View Inventory
Send Money to ben2ong2

View Profile Awards
« on: October 06, 2006, 03:35:19 PM »

For Mozilla, Firefox, Safari, Opera, and Netscape:
var xmlhttp=new XMLHttpRequest()
For Internet Explorer:
var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
Example
<script type="text/javascript">var xmlhttpfunction loadXMLDoc(url){xmlhttp=null// code for Mozilla, etc.if (window.XMLHttpRequest)  {  xmlhttp=new XMLHttpRequest()  }// code for IEelse if (window.ActiveXObject)  {  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")  }if (xmlhttp!=null)  {  xmlhttp.onreadystatechange=state_Change  xmlhttp.open("GET",url,true)  xmlhttp.send(null)  }else  {  alert("Your browser does not support XMLHTTP.")  }}function state_Change(){// if xmlhttp shows "loaded"if (xmlhttp.readyState==4)  {  // if "OK"  if (xmlhttp.status==200)    {    // ...some code here...    }  else    {    alert("Problem retrieving XML data")    }  }}</script>
Note: An important property in the example above is the onreadystatechange property. This property is an event handler which is triggered each time the state of the request changes. The states run from 0 (uninitialized) to 4 (complete). By having the function xmlhttpChange() check for the state changing, we can tell when the process is complete and continue only if it has been successful.
Logged

You are not allowed to view links.
Register or Login
Free Paid Survey & Home Business Resources.

You are not allowed to view links.
Register or Login
Free Article Directory | Quality Content
Ryan's District
« on: October 06, 2006, 03:35:19 PM »

 Logged
Pages: [1]   Go Up
  Send this topic  |  Print  
 
Jump to:  

Archive - WAP2 - WAP - imode
Sponsors: RAYAN.tv
-

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.294 seconds with 30 queries.

Google visited last this page Yesterday at 06:55:37 PM