Publishers of technology books, eBooks, and videos for creative people

Home > Articles

  • Print
  • + Share This
From the author of Creating a Google API JavaScript Object

Creating a Google API JavaScript Object

Using PHP to access the Google Video Search service allows us to create a local JSON result set that is accessible to JavaScript via Ajax. To start parsing the results, we’ll need to download the jsonparser from http://www.json.org. Once you have the jsonparser, create a JavaScript object called GoogleAPI (Listing 2, GoogleAPI.js) and include the jsonparser file at the top of the file using the document.write function in order to keep the JavaScript self-contained. This GoogleAPI object will handle most of the functionality, making all the Ajax requests, parsing the JSON, and rendering the HTML elements in the web page.

  • + Share This
  • 🔖 Save To Your Account