javascript to php function call code example
Example 1: call javascript function from php
// The most basic method
<?php
echo '<script type="text/javascript">',
'someJsFunc();',
'</script>';
?>
// However, if what you are trying to achieve requires more complexity,
// You might be better off adding the V8JS module, see link below
Example 2: 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);
}
});
};