HTML and CSS Reference
In-Depth Information
When the data is received via the
XMLHttpRequest
object, the data will need to be
deserialized into a more user-friendly format. You also might want to submit data to the
server in response to user actions. The next objective examines these concepts.
Thought experiment
Creating a webpage with a stock ticker
In this thought experiment, apply what you've learned about this objective. You can
find answers to these questions in the “Answers” section at the end of this chapter.
You are tasked with building a webpage for your client that involves a stock ticker.
You need to provide real-time stock quotes to your page users in a scroll across the
top of the page. Explain how you would build a web application that will do this
dynamically without posting back the whole webpage.
■
JSON and XML are the most common formats used for data exchange.
■
JSON consists of name/value pairs.
■
XML is a structured element-based document.
■
JavaScript provides built-in support for receiving data via the
XMLHttpRequest
object.
Which of the following is a valid JSON string?
1.
A.
{firstName, Rick, lastname, Delorme, hairColor, brown, eyeColor, brown}
B.
{firstName: Rick; lastname: Delorme; hairColor: brown; eyeColor: brown}
C.
{firstName: “Rick”; lastname: “Delorme”; hairColor: “brown”; eyeColor: “brown”}
D.
{firstName: “Rick”, lastname: “Delorme”, hairColor: “brown”, eyeColor: “brown”}
With the
XMLHttpRequest
object, which of the following properties provides the
response in a human readable format?
2.
A.
Response
B.
responseBody
C.
responseText
D.
responseXML
Search WWH ::
Custom Search