Here is an example, I hope it helps, other than that you can read some tutorials on ajax and understand it better.
beta.html
<!DOCTYPE html>
<html>
<head>
<script>
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
// use the xmlhttp.responseText however you need.
}
}
xmlhttp.open("POST", "functions.php?name="+somename, true); //somename is whatever you want to send in there as name
xmlhttp.send();
}
</script>
</head>
The loadXMLDoc() can be called when a button is clicked or when someone types something in a text field or even with a timer that calls it every few seconds. Just like any other javascript function.
functions.php:
function add($name) {
echo $name.' add function is working'; //Just to test
};
function edit($name|) {
echo $name.' edit function is working'; //Just to test
};
if(isset($_POST['name'])){
$name=$_POST['name'];
add($name);
edit($name);
//whatever other function you want to call
}