I am using ajax with PHP
I want to create cookie on ajax calling page
i have tow domain
like
domain1.com
and domain2.com
i have done ajax code on domain1.com
in page test1.php
And Create Cookie on domain2.com
page test.php
test1.php /// domain1.php
$.ajax({
url:domain2.com/test.php,
type:post,
datatype:json,
data:'uname=test',
success:function(data){
if(data=='ok'){
window.location='http://domain2.com/cookietest.php'
}
}
});
test.php ///// domain2.com
$uname=$_POST['uname'];
if($uname=='test'){
setcookie('testcookie',$uname,time()+3600);
echo 'ok';
}else{
echo 'not'
}
I checked cookie value on domain2.com
cookietest.php ///// domain2.com
<?php
var_dump($_COOKIE);
?>
I did not found created cookie details. can anyone help me