Trigger php function from javascript
I am trying to individually track the number of people who liked my facebook page from a particular webpage. For that I am using FB event. I wish to save the counts to my local database.

Below is the code that I have been trying out. But it is not working.
 
    <?php
    echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:fb=\"http://    www.facebook.com/2008/fbml\">";

    echo "<head>";
    echo "<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js\"></script>";
    echo "<script src=\"http://connect.facebook.net/en_US/all.js#appId=157605600977665&amp;xfbml=1\"></script>";
    echo "<script>";
            
    echo "var a = 0;";
    echo "$(\"document\").ready(function(){";
    echo "FB.Event.subscribe('edge.create', function(href, widget) {";
    //not working
    echo "window.location=\"1.php?action=add";
    echo "});";
    echo "});";
    echo "</script>";
    echo "</head>";
    
    echo "<body>";
    
    if ($action=="add") 
    { 
    mysql_query("update likes set count = count + 1 where id=1;");
    } 
    
    echo "<div id=\"fb-root\"></div>";
    echo "<fb:like href=\"http://www.facebook.com\" send=\"false\" width=\"450\" show_faces=\"false\"></fb:like> <br/>";
    echo "</body>";
    echo "</html>";

    ?>
Trigger php function from javascript
===

I am trying to individually track the number of people who liked my facebook page from a particular webpage. For that I am using FB event. I wish to save the counts to my local database.

Below is the code that I have been trying out. But it is not working.
 
    <?php
    echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:fb=\"http://    www.facebook.com/2008/fbml\">";

    echo "<head>";
    echo "<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js\"></script>";
    echo "<script src=\"http://connect.facebook.net/en_US/all.js#appId=157605600977665&amp;xfbml=1\"></script>";
    echo "<script>";
            
    echo "var a = 0;";
    echo "$(\"document\").ready(function(){";
    echo "FB.Event.subscribe('edge.create', function(href, widget) {";
    //not working
    echo "window.location=\"1.php?action=add";
    echo "});";
    echo "});";
    echo "</script>";
    echo "</head>";
    
    echo "<body>";
    
    if ($action=="add") 
    { 
    mysql_query("update likes set count = count + 1 where id=1;");
    } 
    
    echo "<div id=\"fb-root\"></div>";
    echo "<fb:like href=\"http://www.facebook.com\" send=\"false\" width=\"450\" show_faces=\"false\"></fb:like> <br/>";
    echo "</body>";
    echo "</html>";

    ?>