metadata-1.0 处理bing ajax搜索无返回结果的bug

This commit is contained in:
Li Jianxuan 2011-12-19 07:45:29 +00:00
parent 754320b7d2
commit 8d4f03728b
3 changed files with 7 additions and 1 deletions

View File

@ -533,6 +533,8 @@ function bingSearch(keyword){
success:function(html){ success:function(html){
var items = []; var items = [];
var obj = jQuery.parseJSON(html); var obj = jQuery.parseJSON(html);
if(obj.SearchResponse.Web.Total==0)
{$('#searchlist').html("No results!");return false;}
$.each(obj.SearchResponse.Web.Results, function(key, val) { $.each(obj.SearchResponse.Web.Results, function(key, val) {
var html = '<p><a href="' +val['Url']+'">'+val['Title']+'<a/></p><p><span>' var html = '<p><a href="' +val['Url']+'">'+val['Title']+'<a/></p><p><span>'
+val['DisplayUrl'].replace(/%(.*)/i,"") +'</span></p><p>' +val['DisplayUrl'].replace(/%(.*)/i,"") +'</span></p><p>'

View File

@ -499,6 +499,8 @@ function bingSearch(keyword){
success:function(html){ success:function(html){
var items = []; var items = [];
var obj = jQuery.parseJSON(html); var obj = jQuery.parseJSON(html);
if(obj.SearchResponse.Web.Total==0)
{$('#searchlist').html("No results!");return false;}
$.each(obj.SearchResponse.Web.Results, function(key, val) { $.each(obj.SearchResponse.Web.Results, function(key, val) {
var html = '<p><a href="' +val['Url']+'">'+val['Title']+'<a/></p><p><span>' var html = '<p><a href="' +val['Url']+'">'+val['Title']+'<a/></p><p><span>'
+val['DisplayUrl'].replace(/%(.*)/i,"") +'</span></p><p>' +val['DisplayUrl'].replace(/%(.*)/i,"") +'</span></p><p>'
@ -564,7 +566,7 @@ zoomlevel--;
new GLatLng(<?= $md->south; ?>,<?= $md->east; ?>), new GLatLng(<?= $md->south; ?>,<?= $md->east; ?>),
new GLatLng(<?= $md->south; ?>,<?= $md->west; ?>), new GLatLng(<?= $md->south; ?>,<?= $md->west; ?>),
new GLatLng(<?= $md->north; ?>,<?= $md->west; ?>) new GLatLng(<?= $md->north; ?>,<?= $md->west; ?>)
],"#f33f00",5,1,"#ff0000",0.2); ],"#e4e4e4",5,1,"#FFFFFF",0.0);
map.addOverlay(polygon); map.addOverlay(polygon);
<?php endif; ?> <?php endif; ?>
} }

View File

@ -489,6 +489,8 @@ function bingSearch(keyword){
success:function(html){ success:function(html){
var items = []; var items = [];
var obj = jQuery.parseJSON(html); var obj = jQuery.parseJSON(html);
if(obj.SearchResponse.Web.Total==0)
{$('#searchlist').html("No results!");return false;}
$.each(obj.SearchResponse.Web.Results, function(key, val) { $.each(obj.SearchResponse.Web.Results, function(key, val) {
var html = '<p><a href="' +val['Url']+'">'+val['Title']+'<a/></p><p><span>' var html = '<p><a href="' +val['Url']+'">'+val['Title']+'<a/></p><p><span>'
+val['DisplayUrl'].replace(/%(.*)/i,"") +'</span></p><p>' +val['DisplayUrl'].replace(/%(.*)/i,"") +'</span></p><p>'