Iâm creating a (Buddypress/Wordpress) page where I want to list all members and then let the visitors filter them by for example location by checking checkboxes.
I created a quick mockup in photoshop of what Iâm creating.
I have modified the PHP file members-loop.php to do what I want, and my script successfully works and only list users with locations I add to my $selectedLocations
array. I want visitors to be able to add locations to this arrays with checkboxes.
When a user checks a box I want the page to reload the member-loop.php so that I can add a [POST]
to the submit and filter the page with the criteria from the checkbox. My problem is that I have no idea how to call the loop again. Right now I’m just trying to reload the loop, and I’ll add the POST
when I have achieved that.
I’m trying to call on the loop with this function:
function vedCheckboxValg(){
$.ajax({
url:ajaxurl,
type:'GET',
data: {
action: 'members'
},
success: function(members){
alert('funka det?');
$('#phpdiv').append(members);
}
});
}
The script itself works If I call on a PHP file on my root with a simple echo
, but whatever I do to call on members-loop is not working, and just returns 0
.