I've worked for the site that have two different domains with different server. We are using one domain to show the site details like "SITE A". and one domain that will provide the services like "SITE B". These SITE A, and SITE B have two different databases and session. My task is if user logged in from SITE A it should be automatically logged in SITE B same for vice-versa. I'm using ajax for that. I've successfully get response from SITE A to SITE B. but not able to get it session or cookies from SITE A.
SITE A CODE:
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET, POST");
header("Access-Control-Allow-Credentials: true");
@session_start();
$_SESSION['language']= 'en-US';
echo $_SESSION['language'];
SITE B CODE:
$.get( "site-b-url", function( data ) {
console.log( data );
});
I'm able to get it simple instance data but not able to get it session and cookies data.