Closed jamessullivan77 closed 7 years ago
You could add the success
key value pair within your jQuery.ajax
callback function.
like this?
$('#add_marker').fadeIn().click(function(event){
console.log('clicked, friend');
$.ajax({
url: '/map',
method: 'POST',
data: {
x: location.coords.lat,
y: location.coords.long
},
success: function(data){
marker.setIcon({
url: '/assets/homeless.png',
scaledSize: new google.maps.Size(50, 50)
});
},
success: function(event){
marker.setIcon({
url: '/assets/homeless.png',
scaledSize: new google.maps.Size(50, 50),
("rightclick", function(event){
event.latLng.lat();
event.latLng.lng()
})
}
});
});
You're only allowed to apply a single key per object, so the second success function is now overriding the first. I would simply handle everything you need inside the existing success callback.
ok great, ill combine the two and get back to you if there is an error, thanks!
can I add this as another function underneath the last one we created using success?