function send() {
event.preventDefault();
$element.delay(5000).fadeIn();
function pausing() { .
var cat = 1;
var params = 'dog='+cat;
var xhr = new XMLHttpRequest();
xhr.open("POST", "page.php");
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.send(params);
}
var timeout = setTimeout(pausing, 5000);
}
htmlelement.addEventListener('click', send);
I`m trying to call a session variable from another page and set it equal to a variable to be run in an if statement. I saw a post about passing into functions that used global or passing to function as function($variable) this did not pass into the if statement.
<?php
session_start();
$tag = $_SESSION['hello'];
$dog = $_POST['dog'];
if ($dog == 1) {
echo $tag; //does not pass
}
$GLOBAL['apple'] = $_SESSION['hello'];
//or $GLOBAL['apple'] = $tag;
if ($dog == 1) {
echo $GLOBAL['apple']; //does not pass
}
//also tried
if ($dog == 1) {
globals $tag
echo $tag; //does not pass
}
session_destroy();