Hi anyone please help me. I writted on php simple code test.php. I am just reading cookie only and displaying it. when i execute the below url in chrome browser i am get response
https://www.domainname.com/cbscheck/test.php
response
testa3433^| 1^|1^|0da1d48927ec9118d271cc6a4f0df3e90ee4d296^|1
same php url i called in below html file using xmlhttprequest but i am not getting the above reponse.
file:///G:/Hari/MyTaks/Chat/chatCheck.html
response i am getting empty.
My perception $_COOKIE
not working when i called using xmlhttprequest
. please any help me how to resolve it. i shared code below
testCheck.htm
<html>
<body>
<div id = 'onlineUsers' class='bottomDiv'>
</div>
<script>
var url = 'https://www.somedomain.com/cbscheck/test.php';
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange=function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("onlineUsers").innerHTML = this.responseText;
}
};
xhttp.open("GET", url , true);
xhttp.send();
</script>
</body>
</html>
test.php
<?php
echo $_COOKIE["loginInfo"];
?>