Commit 996709db by Thimo Kraemer

Added X-Requested-With header

parent f4fce475
/*
* KSS-RPC v0.5-beta
* KSS-RPC v0.6-beta
*
* Copyright (c) 2017, joonis new media
* Author: Thimo Kraemer <thimo.kraemer@joonis.de>
......@@ -61,7 +61,7 @@
******************************************************************************************/
var kss = {
version: '0.5-beta',
version: '0.6-beta',
_initialized: false,
_ruleSheets: {},
_eventBinders: {},
......@@ -854,14 +854,16 @@ kss.SEND = function(method, url, data, timeout, headers, callback) {
var async = !!callback, contentType;
var xhr = new XMLHttpRequest();
xhr.open(method, url, async);
if(headers) {
kss.each(headers, function(value, key) {
if (key.toLowerCase() == 'content-type') {
contentType = value;
}
xhr.setRequestHeader(key, value);
});
if (!headers) {
headers = {};
}
headers['X-Requested-With'] = "XMLHttpRequest";
kss.each(headers, function(value, key) {
if (key.toLowerCase() == 'content-type') {
contentType = value;
}
xhr.setRequestHeader(key, value);
});
if(data instanceof Object) {
if (contentType == 'application/json') {
data = kss.toJSON(data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment