Showing posts with label delete fb friend using jquery. Show all posts
Showing posts with label delete fb friend using jquery. Show all posts

Tuesday, May 1, 2012

Deleteting All Facebook friend programmatically using fb graph api, mobile fb site, & jQuery + firequery

$.ajax({
  url: "https://graph.facebook.com/me/friends?access_token=AAAAAAITEghMBABoxQhYsFHaMdnQJgJ1BoDbedvjJdadnwsNPJlZBrQcO0n1FUDg68UZCSJZAtV4rorKr1iOBchJSkLiXY2Gizgz8CdsyyyMmPeG6uvX", // get this at http://developers.facebook.com/docs/reference/api/ take the Friends link and replace it.
  success: function(data) {
    console.log(data)
        jQuery.each(data.data, function() {
            $("input[name=friend_id]").val(this.id)
            $("form:first").serialize()
            $.ajax({
                url: "http://m.facebook.com/a/removefriend.php",
                data: $("form:first").serialize(),
                type: "post"
            })
        });
  },
  dataType: "json"
});
 
Use the fb mobile page (where we have confirm delete friend button) to execute this script.

We need firebug & firequery to jquerify this page before we can execute this script.

Basically, this script will fetch your friend id from the fb graph api & submit the confirm delete friend form using each friend id that it fetched.