Use $.ajax to call a server context (or URL, or whatever) to invoke a particular 'action'. What you want is something like:
Código Javascript
:
Ver original$.ajax({ url: '/my/site',
data: {action: 'test'},
type: 'post',
success: function(output) {
alert(output);
}
});
On the server side, the action POST parameter should be read and the corresponding value should point to the method to invoke, e.g.:
Código PHP:
Ver originalif(isset($_POST['action']) && !empty($_POST['action'])) { $action = $_POST['action'];
switch($action) {
case 'test' : test();break;
case 'blah' : blah();break;
// ...etc...
}
}