Cairo University Faculty of Engineering Computer Engineering Department WEB BUILDING CMPN 425-Fall 2022 1 2 PHP Advanced-cont AJAX 4
31 Questions
1 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is AJAX?

  • A technique for creating fast and dynamic web pages (correct)
  • A type of web server
  • A programming language for building dynamic web pages
  • A method for storing data on the client-side
  • Which object is used to create an XMLHttpRequest in modern browsers?

  • AJAXRequest
  • XMLHttpRequestObject
  • XMLHTTP (correct)
  • ActiveXObject
  • What method is used to send a request to a server using XMLHttpRequest?

  • submitRequest()
  • send() (correct)
  • getServerResponse()
  • sendRequest()
  • What does the responseText property of XMLHttpRequest contain?

    <p>The server's response as a string</p> Signup and view all the answers

    Which applications use AJAX according to the given text?

    <p>Google Search, Google Maps, Gmail</p> Signup and view all the answers

    What happens if a classic web page (not using AJAX) needs to change its content?

    <p>The whole page is reloaded</p> Signup and view all the answers

    What triggers the onreadystatechange event handler?

    <p>Every time the readyState property changes</p> Signup and view all the answers

    When is the response considered ready?

    <p>When readyState is 4 and status is 200</p> Signup and view all the answers

    What happens if the input field in the AJAX and PHP Example is empty?

    <p>The content of txtHint is cleared and the function exits</p> Signup and view all the answers

    What does the xmlhttp.send() method do?

    <p>Sends the request off to a file on the server</p> Signup and view all the answers

    What happens when str.length == 0 in the showHint() function?

    <p>The content of txtHint is cleared and the function exits</p> Signup and view all the answers

    What parameter is added to the URL in the showHint() function?

    <p>(q)</p> Signup and view all the answers

    How many times is onreadystatechange triggered?

    <p>Four times, once for each change in readyState</p> Signup and view all the answers

    xmlhttp.onreadystatechange is designed to be a function that will be called:

    <p>Every time the readyState property changes in XMLHttpRequest</p> Signup and view all the answers

    showHint() function executes what operations when the input field is not empty?

    <p><code>Create an XMLHttpRequest object</code>, <code>Create a function to be executed when the server response is ready</code>, <code>Send the request off to a file on the server</code></p> Signup and view all the answers

    What does 'this.readyState == 4 && this.status == 200' represent?

    <p>Condition for checking if response is ready</p> Signup and view all the answers

    What is the purpose of AJAX in web development?

    <p>To update parts of a web page without reloading the whole page</p> Signup and view all the answers

    Which object is used to create an XMLHttpRequest in modern browsers?

    <p>XMLHttpRequest object</p> Signup and view all the answers

    What does the 'xmlhttp.onreadystatechange' event handler represent?

    <p>The function that will be called when readyState changes</p> Signup and view all the answers

    What happens if the input field in the AJAX and PHP Example is empty?

    <p>No request is sent to the server</p> Signup and view all the answers

    What is the responseText property of XMLHttpRequest used for?

    <p>To store the response from the server as a text string</p> Signup and view all the answers

    When should old versions of Internet Explorer (IE5 and IE6) use an ActiveX Object to create an XMLHttpRequest?

    <p>Old versions of Internet Explorer should never use an ActiveX Object</p> Signup and view all the answers

    What is the purpose of the onreadystatechange event handler in the context of XMLHttpRequest?

    <p>To define a function that is called when the readyState property changes</p> Signup and view all the answers

    What does 'this.readyState == 4 && this.status == 200' represent in the context of XMLHttpRequest?

    <p>A check for successful server response readiness</p> Signup and view all the answers

    What happens when str.length == 0 in the showHint() function?

    <p>The content of the txtHint placeholder is cleared</p> Signup and view all the answers

    In the context of AJAX and PHP Example, what does the showHint() function do when the input field is not empty?

    <p>Adds a parameter to the URL and sends a request to a file on the server</p> Signup and view all the answers

    What triggers the onreadystatechange event handler in the context of XMLHttpRequest?

    <p>Changes in readyState property of the XMLHttpRequest</p> Signup and view all the answers

    What does the xmlhttp.send() method do in the context of XMLHttpRequest?

    <p>Sends a request to the server</p> Signup and view all the answers

    What are three important properties of the XMLHttpRequest object that determine if the response is ready?

    <p>'readyState', 'status', 'responseText'</p> Signup and view all the answers

    When is the response considered ready in the context of XMLHttpRequest?

    <p>When readyState is 4 and status is 200</p> Signup and view all the answers

    What happens if a classic web page (not using AJAX) needs to change its content?

    <p>It reloads the entire page to change its content</p> Signup and view all the answers

    More Like This

    Use Quizgecko on...
    Browser
    Browser