HTML and CSS Reference
At which stage during an XMLHttpRequest are user credentials sent to the server?
When the connection is opened
When the request is sent
When the ready state is complete
When the server sends a security response requesting the credentials
Data can be received and sent in many forms. In the preceding objective, JSON and XML were
examined specifically. The notion of presenting JSON or XML data directly to users isn't ideal.
Users would appreciate receiving the data in a more usable or readable and meaningful way.
For this, you need to have the data converted from an XML string or JSON string into some-
thing else. The concept of converting the data from one form to another is called serialization
With serialization , the data is put into a format for transmission. With deserialization , the
transmitted data is converted into something that can be worked with, such as a custom
object. In addition to working with string data, applications can work with binary data. An
application might capture drawings or pictures on a canvas and send that data back to the
server. The data needs to be serialized into a binary stream to achieve this.
This objective reviews the serialization, deserialization, and transmission of binary
and text data. The ability to submit data via the HTML Form and sending data with the
XMLHttpRequest object is also reviewed.
This objective covers how to:
■ Send data by using XMLHttpRequest
■ Serialize and deserialize JSON data
■ Serialize and deserialize binary data
Sending data to the server is similar to receiving data. The code examples in the preceding
objective used the XMLHttpRequest object to receive data. The XMLHttpRequest object itself
is agnostic to sending or receiving. It can accomplish both tasks based on how the object is
set up. To send data, the send method must have data passed into it, and that data can be