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.

Nope. One request will be handled with each call. You will only run into problems if for example request A changes a session var that request B needs as well.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.