Solution:
Add following on your plugin or themes functions.php
file
function wpse16119876_init_session() {
if ( ! session_id() ) {
session_start();
}
}
// Start session on init hook.
add_action( 'init', 'wpse16119876_init_session' );
Next, to add data in SESSION
–
// If session has started, this data will be stored.
$_SESSION['arrayImg'] = $abc;
To get the data on ajax hooked function –
// handle the ajax request
function wpse16119876_handle_ajax_request() {
if ( ! session_id() ) {
session_start();
}
if ( array_key_exists( 'arrayImg', $_SESSION ) ) {
$abc = $_SESSION['arrayImg'];
} else {
$abc = 'NOT IN SESSION DATA';
}
// Do something with $abc
}