Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/**
* Fetch the Members locations using AJAX
*
* The action sent to the WordPress router is: woffice_map_members
*/
fetchLocations: function () {
var self = this;
$.ajax({
url: this.url,
type: 'POST',
data: {
action: 'woffice_map_members',
_nonce: this.nonce,
},
success: function (data) {
if (data.length === 0) {
return;
}
// We parse it from JSON to an Array
var returnedMembers = JSON.parse(data);
// We don't add it if there is any error
if (returnedMembers.error !== undefined) {
return;
}
self.members = returnedMembers;
// Let's draw the markers
self.drawMarkers();
}
});
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.