I have this button:

PHP Code:
<a id="m_location" href="#" data-role="button" data-icon="search" data-latitude="<?php echo $mLatitude?>" data-longitude="<?php echo $mLongitude?>">Help me find this</a>
And I need to pass the data-longitude and data-latitude variables to a javascript function:

Code:
						$('#m_location').click(function() {
							var mlatlng = new google.maps.LatLng($('#m_location').data('latitude'), $('#m_location').data('longitude'));
							$('#map_canvas').gmap('search', { 'location': mlatlng }, function(results, status) {
								if ( status === 'OK' ) {
									$('#to').val(results[0].formatted_address);
								}
							});
						});
The above code doesn't work though, and nothing happens in the form field (#to) when I click. Help?

Btw, I don't have to do this through data-attributes, I simply need to add the variables to the button, and then pass them to the function and run the function when the button is clicked. The page may contain many different buttons with different values that need to be passed on click.