I have a PHP function:
function saveSnapshot() {
header("Content-Type: application/JSON: charset=UTF-8");
global $CFG;
$resString = "{\"Success\": \"True\"}";
$snapshotName = getArgument("snapshotName");
$user = getArgument("userId");
$ttd = getArgument("ttData");
$fed = getArgument("feData");
$ttData = json_decode($ttd, true);
$feData = json_decode($fed, true);
And I'm calling this function using Javascript Ajax call:
xhttp.open("POST", "myfile.php", true); // asynchronous
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.send("reqType=saveNewSnapshot&newSnapshotName=" + newSnapshotName + "¤tSnapshotName=" + currentSnapshotName +
"&configId=" + currentConfigId + "&ttData=" + JSON.stringify(timeTable) +
"&feData=" + JSON.stringify(fixedEntry));
Now instead of calling the saveSnapshot function in php file using javascript ajax, I want to call the saveSnapshot function from some other PHP file.
How do I do this? How do I make the call? How do I pass the parameters?