Which code segment should you insert at line 04?

You develop an HTML5 application. The application uses an image that is returned from an HTTP
POST request.
You develop the following code: (Line numbers are included for reference only.)

You need to display the loaded image in the application.
Which code segment should you insert at line 04?

You develop an HTML5 application. The application uses an image that is returned from an HTTP
POST request.
You develop the following code: (Line numbers are included for reference only.)

You need to display the loaded image in the application.
Which code segment should you insert at line 04?

A.
Option A

B.
Option B

C.
Option C

D.
Option D



Leave a Reply 3

Your email address will not be published. Required fields are marked *

2 × 1 =


Al

Al

That fact that this is a POST request doesn’t make sense to me. None of the answers work as is. B works if the request method is changed to GET.

Helpful_coder

Helpful_coder

POST can be used to retrieve data as well as send data

afkar

afkar

function loadDoc() {
var xhttp = new XMLHttpRequest();
xhttp.open(“GET”, “/p1.png”, true);
var img = document.createElement(‘img’);
xhttp.responseType = ‘blob’;
xhttp.onload = function (e) {
if (xhttp.readyState == 4 && xhttp.status == 200) {
img.src = window.URL.createObjectURL(this.response);
document.body.appendChild(img);
}
};
xhttp.send();
}