01.
jQuery.ajax({
02.
type:
"POST"
,
03.
url:
'your_functions_address.php'
,
04.
dataType:
'json'
,
05.
data: {functionname:
'add'
, arguments: [1, 2]},
06.
07.
success:
function
(obj, textstatus) {
08.
if
( !(
'error'
in
obj) ) {
09.
yourVariable = obj.result;
10.
}
11.
else
{
12.
console.log(obj.error);
13.
}
14.
}
15.
});