UNC-Chapel Hill INLS 672 - XMLHttpRequest Object (35 pages)

Previewing pages 1, 2, 16, 17, 18, 34, 35 of 35 page document View the full content.
View Full Document

XMLHttpRequest Object



Previewing pages 1, 2, 16, 17, 18, 34, 35 of actual document.

View the full content.
View Full Document
View Full Document

XMLHttpRequest Object

65 views

Lecture Notes


Pages:
35
School:
University of North Carolina at Chapel Hill
Course:
Inls 672 - Web Development II
Web Development II Documents

Unformatted text preview:

Before we get started Tonight an optional lab Groups Other Questions Ajax XMLHttpRequest object Quick Review and More Details Using XMLHttpRequest Create the object in most current browsers thusly and bind to a variable http request new XMLHttpRequest With IE 5 and 6 use http request new ActiveXObject Microsoft XMLHTTP Create a link between the event handler and a function that handles the results http request onreadystatechange a function you define Create a connection and send the request http request open GET url true http request send null Examples from http developer mozilla org en docs AJAX Getting Started http developer mozilla org en docs AJAX Getting Started Distinguishing Browsers Since this isn t a standard IE 5 6 and Mozilla differ in implementing XMLHttpRequest if window XMLHttpRequest Mozilla Safari Fortunately can test http request newyou XMLHttpRequest for this easily else if window ActiveXObject IE try http request new ActiveXObject Msxml2 XMLHTTP catch e try http request new ActiveXObject Microsoft XMLHTTP catch e example from http developer mozilla org en docs AJAX Getting Started http developer mozilla org en docs AJAX Getting Started Handling Errors and Doing Something Finally we need to check if the request was successful and do something based on that if http request alert Giving up Cannot an XMLHTTP instance Note the use of ancreate anonymous function return false http request onreadystatechange function This is the what that happens alertContents http request http request open GET url true http request send null example from http developer mozilla org en docs AJAX Getting Started The alertContents function function alertContents http request if http request readyState 4 if http request status 200 alert http request responseText else alert There was a problem with the request The Trigger Finally a trigger to call the function span style cursor pointer text decoration underline onclick makeRequest test html Make a request span More than one



View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view XMLHttpRequest Object and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view XMLHttpRequest Object and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?