jQuery.ajax({ type: "POST", url: 'http://localhost/SampleService/MyService.php', dataType: 'json', data: {functionname: 'Function_A',Parameter_A: "value A",Parameter_B: "value B"}, beforeSend: function (jqXHR, Settings) { jqXHR.url = Settings.url; $("#ShowPreLoader").show(); }, success: function (obj, textstatus) { }); }, complete: function () { $("#ShowPreLoader").hide(); } });
In your PHP MyService.php
switch($_POST['functionname']) { case 'Function_A':Function_A($_POST['Parameter_A'],$_POST['Parameter_B']); break; case 'Function_B':Function_B($_POST['Parameter_C']); break; case 'Function_C':Function_C(); break; } function Function_A($Parameter_A,$Parameter_B) { print_r(json_encode($ResultArray)); }