AJAX Intro

AJAX Request Build

AJAX Examples


AJAX XMLHttpRequest Methods


setRequestHeader : After requested URL open, use setRequestHeader to provide any optional HTTP headers for the request.

Syntax :

setRequestHeader("label", "value");

Example :

xhr.setRequestHeader("Cache-Control", "no-cache");
xhr.setRequestHeader("User-Agent", "navigator.userAgent");

abort : abort method you can abort the request.

Syntax :

abort();

Example :

xhr.abort();

getResponseHeader : getResponseHeader method you can get the value of the specified HTTP header.

Syntax :

getResponseHeader(header_name);

Example :

var xhr_header = xhr.getResponseHeader("Content-Type");

Run it...   »


getAllResponseHeaders : getAllResponseHeaders method you can get the all values of HTTP headers as a string.

Syntax :

getAllResponseHeaders();

Example :

var xhr_header = xhr.getAllResponseHeaders();

Run it...   »