Skip to content

Instantly share code, notes, and snippets.

@ngdanghau
Created June 9, 2018 17:03
Show Gist options
  • Save ngdanghau/ddb59ca8afa80e2bcb5ee7dfdbf6f4af to your computer and use it in GitHub Desktop.
Save ngdanghau/ddb59ca8afa80e2bcb5ee7dfdbf6f4af to your computer and use it in GitHub Desktop.
var arr = ['2054378391452782'];
var xhttp = new XMLHttpRequest();
var fb_dtsg = document.getElementsByName("fb_dtsg")[0].value;
arr.forEach(function(gid) {
xhttp.open("POST", "https://www.facebook.com/ajax/groups/membership/leave.php", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.send("group_id=" + gid + "&ref=group_mall&dpr=1&fb_dtsg=" + fb_dtsg + "&prevent_readd=on&confirmed=1");
console.log(gid + " => Successfully");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment