2
我對這個真的很陌生。從這裏到那邊閱讀我試圖用bing search API編寫一些代碼,但似乎沒有發生。bing web查詢Api phonegap android
var appid = "API KEY";
function init() {
document.addEventListener("deviceready", deviceready, true);
}
function deviceready() {
console.log('loaded');
$("#searchButton").bind("touchstart",function() {
var s = $.trim($("#searchField").val());
console.log("going to search for "+s);
$.getJSON("http://api.bing.net/json.aspx?Appid="+appid+"&query="+escape(s)+"&sources=image&image.count=20&Market=%27ar-XA%27&Latitude=11.111&Longitude=11.1111&$top=50", {}, function(res) {
var results = res.SearchResponse.image.Results;
if(results.length == 0) {
$("#results").html("No results!");
return;
}
var s = "";
for(var i=0; i<results.length; i++) {
s+= "<p>"+results[i].Title+"<br/><a href='"+results[i].Url+"'>"+results[i].DisplayUrl+"</a></p>";
}
$("#results").html(s);
});
});
}
任何幫助將非常感激。我一直在拉我的頭髮。
請專家門診有任何幫助......