JSFiddle - React, Tailwind, and code Playground
HTML
<?php
session_start();
?>
<!DOCTYPE html>
<head>
<title>JavaScript Test</title>
<?php
if (!isset($_SESSION['JavaScript'])) {
copy('false.php', 'body_message.php');
?>
<script>
var ajax = {},
hasAX = window.hasOwnProperty("ActiveXObject");
ajax.x = function() {
if (hasAX) {
var a = "MSXML2.XmlHttp.6.0 MSXML2.XmlHttp.5.0 MSXML2.XmlHttp.4.0 MSXML2.XmlHttp.3.0 MSXML2.XmlHttp.2.0 Microsoft.XMLHTTP".split(" "),
b, c = 0;
while (c < a.length) {
try {
b = new ActiveXObject(a[c]);
break
} catch (f) {
alert(f)
}
c += 1
}
return b
}
return new XMLHttpRequest
};
ajax.send = function(URL, success, method, data, useAsync) {
if (useAsync === void 0) {
useAsync = false;
}
var xhr = ajax.x();
xhr.open(method, URL, useAsync);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
success(xhr.responseText);
location.replace("index.php");
}
};
if (method === "POST") {
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
}
xhr.send(data)
};
ajax.post = function(URL, object, success, useAsync) {
var array = [];
Object.keys(object).forEach(function(object_props) {
array.push(encodeURIComponent(object_props) + "=" + encodeURIComponent(object[object_props])) // Wrong!
});
ajax.send(URL, success, "POST", array.join("&"), useAsync)
};
function logStuff(a) {
"string" === typeof a ? console.log(a) : "object" === typeof a && Object.keys(a).forEach(function(b) {
console.log(b + ": " + a[b])
})
}
...