I have created a .module file which includes a form and an ajax call back. Here is a simple code of the .module file:
function form_registration_form($form, &$form_state) {
$form['registration']['email'] = array(
'#type' => 'textfield',
'#required' => TRUE,
'#size' => 44,
'#maxlength' => '80',
'#attributes'=> array('placeholder' => 'Email','data-email'=>'','data-min-chars'=>'5'),
);
$form['registration']['password'] = array(
'#type' => 'password',
'#required' => TRUE,
'#size' => 44,
'#maxlength' => '80',
'#attributes'=> array('placeholder' => 'Password'),
);
$form['registration']['submit'] = array(
'#value' => 'SIGN IN',
'#type' => 'submit',
'#submit' => array('form_registration_handler'),
);
return $form;
}
and in the function form_registration_handler I create a session (name it test).
Here is the ajax menu call back function:
function mymodule_menu() {
$items['ajax/innerAction'] = array(
'title' => 'Browser Inner Action',
'page callback' => 'innerActionCallBack',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
function innerActionCallBack() {
header('Access-Control-Allow-Origin: *');
drupal_session_start();
print session_id();
}
This function is used on my page.tpl.php file to create an ajax to server. The problem here is when I call the ajax, the session id is different when I refresh the browser and I can not retreive the Session test that I created earlier. Do you know what is happening here. Any helps are really appreciated.