Seo Master present to you:
We are very fortunate at Google to have amazing people come in to speak to us on many interesting topics. We record these talks and make them available on Google Video. We recently added a feature on the Google Code website that displays recent videos from our tech talk series. You could do this directly using the Video Bar or the Video Search Control which have wizards to make implementation trivial. In our case, we wanted to make the bottom right portlet fit in with the look and feel of the rest of the site, so we decided to go a little more low level. The the AJAX Search API the actually act of searching happens in the Searchers set of JavaScript classes. We used the GvideoSearch class which extends the base GSearch functionality to work with Google Video. The resulting code was simple. At its heart we:
We used this to dynamically create the HTML and then inserted it into the DOM with innerHTML. var result = videoSearch.results[x]; A bit ugly, I know. If we wanted a cleaner approach, we could have used DOM methods directly, or we could have created this using a JavaScript Template package. What is important to know, is that the AJAX Search API is a powerful beast. On the one hand you can run a wizard and get results that you can copy and paste onto your web pages. On the other hand you can get low level and query the backend which returns simple JSON for you to manipulate. The AJAX Search team seems to release something new on just about a weekly basis, so subscribe to the Google AJAX Search API Blog to follow along.2013, By: Seo Master |
Labels: ajax search, howto