views:

23

answers:

1

I'm trying to do something rather simple but I'm getting a strange result. I have an event trigger that I'm using to pass a json object but when it gets through to the other side it's a function... I alert the result and it shows this:

example of alert sting:

alert('value of lattitude? ' + map.currentLatLng.lat);

result:

value of lattitude? function () {return this[a];}

I've tried setting up the trigger both with and without the array literal wrapper:

$('body').trigger('updateLocation', [{lat:38.905003, lng:-77.066497}]);
$('body').trigger('updateLocation', {lat:38.905003, lng:-77.066497});

What am I doing wrong?

A: 

Use the code below it's 100% working

$('body').bind('updateLocation',function(event,obj){
    alert(obj.lng);
});

$('body').trigger('updateLocation', [{lat:38.905003,lng:-77.066497}]);

From.ME.to.YOU