我正在使用 Geonames 网络服务在我的网站上进行注册。如果发生错误,我想给自己发送一封包含错误的电子邮件。Geonames 返回异常http://www.geonames.org/export/webservice-exception.html 但我不确定如何显示它们。
当用户输入位置时,我在 Jquery 中使用 Geonames 来自动完成位置。
$( "#location" ).autocomplete({
source: function( request, response ) {
$.ajax({
url: "http://ws.geonames.org/searchJSON",
dataType: "jsonp",
data: {
q: request.term,
featureClass: "P",
style: "full",
maxRows: 10
},
success: function( data ) {
response( $.map( data.geonames, function( item ) {
return {
label: item.name + (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName,
value: item.name,
latitude: item.lat,
longitude: item.lng,
status: item.status
}
}));
在成功函数中,最后一个参数 status 应该返回请求的状态。我将它附加到一个 div 但没有出现。请帮助我..我不确定我做错了什么。