I've got problems with my code. I've made one global file for all of my includes.
define('A', 'app/');
define('C', 'config/');
define('S', 'classes/');
define('P', 'pages/');
define('J', 'ajax/');
define('T', 'post/');
define('B', realpath(dirname(__FILE__) ) . '/');
/*
Invoegen van de classes. Nieuwe classes gelieven bij te schrijven. De Letter voor de map is de link naar het bestand, zoals bij de
eerdere voorbeelden weergegeven.
*/
require_once(B . A . C . 'config.inc.php');
require_once(B . A . S . 'class.functions.php');
require_once(B . A . S . 'functions.php');
require_once(B . A . S . 'class.database.php');
require_once(B . A . S . 'class.users.php');
with ajax i post to postlogin.php
$.ajax({
url: 'app/classes/ajax/post/postlogin.php',
type: "POST",
dataType: "json",
data: {method: method, email: email, password: password},
//contentType: "application/json; charset=utf-8",
success: function (returnmsg) {
var bla = returnmsg.msg;
alert(bla);
},
error: function (xhr, status, error) {
alert("error " +xhr.responseText);
}
});
but when i post to postlogin.php he doensn't find my class class.users.php
when i call this class in my index it will work.
postlogin.php:
<?php
return Users::AdminLogin();
?>
hopefully someone could help me..
P.S. Sorry for bad english i hope someone understands.
You need to include your "global file" in postlogin.php. PHP has no way of knowing this file exists and your AJAX request goes straight to postlogin.php.
You can also just include your class.users.php
file alternatively.