This plugin contains 2 function:
Return true if your browser have GEO API support, false if not. Example:
$('#checkSupport').click(function () { if ($.geoSupport()) { setMessage('You browser have GEO API'); } else { setMessage('You browser don\'t have GEO API'); } });
Using this function with two parameter: jQuery.geo(successCallback, errorCallback)
- first parameter is successCallback: If your browser have GEO API support, jQuery.geo will call this function with two arguments: latitude and longitude of your position
- second parameter is optional, if have and when GEO API call have error, jQuery.geo will call this function with one arguments: error return from GEO API
Example:
- with only one parameter:
$('#getGeoLocation').click(function () { $.geo(function (latitude, longitude) { setMessage('Your latitude position: ' + latitude + '
and longitude position: ' + longitude); }); });
- with two parameter, first parameter is function has been define:
function callback (latitude, longitude) { setMessage('Your latitude position: ' + latitude + '
and longitude position: ' + longitude); } $('#getGeoLocationError').click(function () { $.geo(callback, function (error) { setMessage(error.toString()); }); });
See more at: http://apps.sanglt.com/jgeo/