runScript : function(s, url) {
s.type ='text/javascript';
s.charset ='utf-8';
s.src = url;
$.head.appendChild(s);
},
Here we're adding attributes to the previously-created script node s--which is actually $.searchScript, passed from doStuff--and appending it to the HEAD of the document, stored in private variable $.head.callback=SEARCH.showSearchResults:showSearchResults : function(result) {
if (result.ResultSet) {
var p = 'Search results found for ' + $.q.value + ': ';
alert(p + ' ' + result.ResultSet.totalResultsAvailable);
}
}
If we don't have result.ResultSet, we don't bother. (Yes, there is much yet to be done around error trapping.) For now we're accepting the return, calling it result, and alerting the total number of results found for the query.prev - http://kentbrewster.com/build-a-search-app/code/code5.html - next