var formBlock = document.getElementById("comments-form");
$.ajax({
type: "POST",
url: '/assets/modalform/mail.php',
cache: false,
data: formNm.serialize(),
success: function (data) {
// Вывод сообщения об успешной отправке
message.html(data);
formTitle.css("display","none");
setTimeout(function(){
formBlock.css("display","none");
}, 9000);
},
if (file_exists($lib_path)){
require_once ($lib_path);
}
<?php
// Выполняет автозагрузку классов
require_once (ROOT.DS.'config'.DS.'config.php');
function __autoload($class_name){
$lib_path = ROOT.DS.'lib'.DS.strtolower($class_name).'.class.php';
$model_path = ROOT.DS.'models'.DS.strtolower($class_name).'.php';
if (file_exists($lib_path)){
require_once ($lib_path);
}
// Возвращает маршрут фронт или админки default или admin
$layout = new Router($uri);
$layout = $layout->getRoute();
if ($layout == 'admin'){
$controllers_path = ROOT.DS.'controllers/admin'.DS.str_replace('controller', '', strtolower($class_name)).'.controller.php';
} else {
$controllers_path = ROOT.DS.'controllers'.DS.str_replace('controller', '', strtolower($class_name)).'.controller.php';
}
if (file_exists($controllers_path)){
require_once ($controllers_path);
} elseif (file_exists($model_path)){
require_once ($model_path);
} else {
// header( "Location: /404/index.html", true);
throw new Exception('Failed to include class' . $class_name);
}
}
В чем проблема обращаться к данным сессии в обработчике "любой формы"? При чем здесь AJAX?