I used the JSON sample at \Live Search API 2.0 SDK\Samples\JSON\WebSample.html
the sample worked fine as is, but when I added a site:mysite.com like this on line 21
"&Query=peter site:mysite.com"it stopped returning any results, even though the same query on search.live.com works.
After playing around for a while, I figured out I had to remove
+ "&Web.FileType=DOC"
and while I was at it, I also removed:
+ "&Market=en-us"now the searches worked.
The second problem was when they were really no search results, I got a JavaScript error:
results is undefined (response.SearchResponse.Web.Offset + results.length)on line: 84
To fix this, I added some code around the results display:
if (response.SearchResponse.Web.Results == null) { resultsHeader.innerHTML = "No results found"; } else { // display results ... }