I'm using ajax in wordpress to get the output of a function:
jQuery.ajax({
type: "POST",
url:"wp-admin/admin-ajax.php",
data:'action=nafham_list_cats_selection&selection_id=' + $selection_id,
success:function(results){
jQuery(".semester_selection").empty();
jQuery(".semester_selection").prop('disabled', false);
jQuery(".semester_selection").append(results);
}
})
And here's the function I use:
function nafham_list_cats_selection() {
if(isset($_POST['selection_id'])){
nafham_get_listed_cats($_POST['selection_id']);
die();
}
}
Using jQuery ajax I'm able to get the output of the function, but what I need to do is to get multiple outputs like if the function echos two variables, I'd like to be able to use the two values separated in the ajax response, is that possible?