I have a piece of Javascript that invokes a social publishing widget overlay. When you load the page the overlay will popup and this is the script that calls it:
<script type="text/javascript">
RPXNOW.loadAndRun(['Social'], function () {
var activity = new RPXNOW.Social.Activity(
"Share your comment",
"commented on 'Like My New Perfume?' on cuteoverload.com",
"http://cuteoverload.com/2009/10/26/like-my-new-perfume/");
RPXNOW.Social.publishActivity(activity);
});
</script>
I need put somehow create a javascript or php function that will fire when this PHP function is called:
function response($oAlert) {
// something to happen here;
}
Since PHP runs on the server and Javascript runs on the client, you can call a remote PHP function from within a Javascript (using an XMLHTTP Request) but you cannot call a Javascript function from a PHP function. The above code snippet is doing a callback to the publishActivity function so you could call your PHP function inside the callback and you can trigger another responder javascript function which will wait for the AJAX response and trigger depending on what the response is.