HTML and CSS Reference
In-Depth Information
options.url += options.data;
options.data = null;
}
} else {
options.data = null;
}
}
function defaultHeader(transport, headers, header, val) {
if (!headers[header]) {
transport.setRequestHeader(header, val);
}
}
function setHeaders(options) {
var headers = options.headers || {};
var transport = options.transport;
tddjs.each(headers, function (header, value) {
transport.setRequestHeader(header, value);
});
if (options.method == "POST" && options.data) {
defaultHeader(transport, headers,
"Content-Type",
"application/x-www-form-urlencoded");
defaultHeader(transport, headers,
"Content-Length", options.data.length);
}
defaultHeader(transport, headers,
"X-Requested-With", "XMLHttpRequest");
}
// Public methods
function request(url, options){
if (typeof url != "string") {
throw new TypeError("URL should be string");
}
options = tddjs.extend({}, options);
options.url = url;
setData(options);
Search WWH ::




Custom Search