I am trying to write a Vue.JS module to do some data processing and send variables to a PHP functions in a seperate file. I'm using Axios to parse parameters to PHP. Now the problem is, the Axios request reaches the PHP file, but the PHP doesn't actually call the function that was intented to call.
PHP call from Vue app:
axios.post('./crmFunctions.php',{ params: { function2call:"sendQuery", id:1, mid:1, message: "Hello there!", event:"Query" }})
.then(response => this.responseData = response.data)
.catch(error => {});
PHP interpretation code:
if(isset($_POST['function2call']) && !empty($_POST['function2call'])) {
if( !isset($_POST['arguments']) ) { $aResult['error'] = 'No function arguments!'; }{
$function2call = $_POST['function2call'];
switch($function2call) {
case 'sendQuery' : sendQuery($_POST['arguments'][0],$_POST['arguments'][1],$_POST['arguments'][2],$_POST['arguments'][3]);
break;
case 'other' : // do something;break;
// other cases
}
}
}
Where am I going wrong with this code? I managed to call the same function on AJAX previously.