XMLHttpRequest.responseType

XMLHttpRequest.responseType - тип відповіді сервера.

Синтаксис:

XMLHttpRequest.responseType;

Параметри:

XMLHttpRequest - об'єкт XMLHttpRequest.

Опис:

responseType властивість об'єкту XMLHttpRequest яка повертає/задає рядок з типом відповіді сервера.

Присвоєння значення властивості responseType можливо лише у XMLHttpRequest2.

Приклад:

var xhr = new XMLHttpRequest(); xhr.open('GET', '', true); xhr.onload = function(){ alert( this.responseType ); }; xhr.send(null); var xhr = new XMLHttpRequest(); xhr.open('GET', ''); xhr.onload=function(){ alert("Завантажено. Тип: "+xhr.responseType); } xhr.responseType="text"; xhr.send(null);