mcrypt_decrypt function php code example

Example 1: PHP Deprecated: Function create_function()

//From
create_function( '$caps', "return '$caps';" );

//To
function($caps) {return $caps;}

Example 2: jquery code to trigger php function

$.ajax({ url: 'phpscriptname.php',
         data: {function2call: 'getEmployeesList', otherkey:otherdata},
         type: 'post',
         success: function(output) {
                      alert(output);
         }
});

Example 3: javascript call php function with parameters

var deleteClient = function(id) {
    $.ajax({
        url: 'path/to/php/file',
        type: 'POST',
        data: {id:id},
        success: function(data) {
            console.log(data); // Inspect this in your console
        }
    });
};