Level 15 Level 17
Level 16

AJAX 13


10 words 0 ignored

Ready to learn       Ready to review

Ignore words

Check the boxes below to ignore/unignore words, then click save at the bottom. Ignored words will never appear in any learning session.

All None

Ignore?
onreadystatechange Event
When a request to a server is sent, we want to perform some actions based on the response.\n\nThe onreadystatechange event is triggered every time the readyState changes.\n\nThe readyState property holds the status of the XMLHttpRequest.
onreadystatechange
Stores a function (or the name of a function) to be called automatically each time the readyState property changes
readyState
Holds the status of the XMLHttpRequest. Changes from 0 to 4: \n0: request not initialized \n1: server connection established\n2: request received \n3: processing request \n4: request finished and response is ready
status
200: "OK"\n404: Page not found
When readyState is 4 and status is 200, the response is ready
xmlhttp.onreadystatechange=function()\n {\n if (xmlhttp.readyState==4 && xmlhttp.status==200)\n {\n document.getElementById("myDiv").innerHTML=xmlhttp.responseText;\n }\n }
Using a Callback Function explanation
A callback function is a function passed as a parameter to another function.\n\nIf you have more than one AJAX task on your website, you should create ONE standard function for creating the XMLHttpRequest object,…
Using a Callback Function
function myFunction() {\nloadXMLDoc("ajax_info.txt",function() {\n if (xmlhttp.readyState==4 && xmlhttp.status==200) {\ndocument.getElementById("myDiv").innerHTML=xmlhttp.responseText; } }); }
hidden iframes technique
iframes can be place anywhere on a page, this enabled developers t place invisible frames on a page to enable client–server communication. Once DOM introduced iframes can be created on the fly.
sample loadXMLDoc() function
<head> <script type="text/javascript">\nfunction loadXMLDoc() { \n.... AJAX script goes here ...\n} </script></head> \n–––html code–––\n<!DOCTYPE html><html><body>\n<div id="myDiv"><h2>Let AJAX change this text</h2></div>\n<button type="button" onclick="loadXMLDoc()">Change Content</button>\n</body> </html>
All modern browsers (IE7+, Firefox, Chrome, Safari, and Opera) have a _______ object.
All modern browsers (IE7+, Firefox, Chrome, Safari, and Opera) have a built–in XMLHttpRequest object.\n\nSyntax for creating an XMLHttpRequest object:\n\nvariable=new XMLHttpRequest();Old versions of Internet Explorer (IE5 and IE6) uses an ActiveX Object:\n\nvariable=new ActiveXObject("Microsoft.XMLHTTP");