So I managed to do it with this functions if anyone is interested.
function GetMembersOfGroup(grpName){
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/sitegroups/getByName('"+ grpName +"')/users",
type: "GET",
headers: {"accept": "application/json;odata=verbose"},
success: function (data){
if (data.d.results)
{
for (var i = 0; i < data.d.results.length; i++) {
//Loop through all users and binding in dropdown
if (data.d.results[i] != null && data.d.results[i] != undefined) {
if (data.d.results[i].LoginName == "i:0#.w|ad\\" + document.getElementById("userCkToRemove").value.toLowerCase()) {
if ($("#groupNameToRemove option[value='" + data.d.results[i] + "‘]").length == 0) {
$('#groupNameToRemove').append($("<option/>", {
value: data.d.results[i].Email,
text: grpName
}));
}
}
}
}
}
},
error: function (error) {
alert(JSON.stringify(error));
}
});
}
This functions exports all members and checks whether the login name of export "file" equals the login name that we want to search (coming from input box in html). If yes then we add the name of the group in the drop-down tag based on id #groupNameToRemove which is select tag and I create and option tag within it per each group that the user is member