Cross sub-domain ajax form submit with session
I'm working on something here.
Javascript
$('#create').submit(function() {
$.ajax({
data: $(this).serialize(),
type: $(this).attr('method'),
url: $(this).attr('action'),
success: function(response) {
console.log(response);
}
});
return false;
});
Php file (url):
session_start();
header('Access-Control-Allow-Origin: *');
session_set_cookie_params( time() + 3600, '/', '.domain.com');
print_r($_SESSION);
die;
On the page with the form my session[memberid] = [some int];
But if i make the ajax call the whole sesison variable is empty
I tried looking on google for some answers, i tried looking for some
answers on stack overflow
but nothing really helped. And i do not prefer using an iframe. Maybe that
was the solution, but maybe there is someone who knows what i need to do
here.
The form is located at the domain m.domain.com and the php file is located
at domain.com