I am attempting to organize my code in the following manner:
if (is_ajax()) {
if (isset($_POST["action"]) && !empty($_POST["action"])) { //Checks if action value exists
$action = $_POST["action"];
switch($action) { //Switch case for value of action
case "initMsg": initMsg_function(); break;
case "initCombo": initCombo_function(); break;
}
}
}
function is_ajax() {
return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
}
Whereby every ajax call invokes a method (business logic) associated to the call.
By any chance will my code cause any concurrency issue?
Your help is kindly appreciated.
Thank You.