Created
February 5, 2019 22:19
-
-
Save 2Fwebd/0f8e147124709fa6435e16365a62255b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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