Google Ajax API

Is it possible to use Google AJAX API : on local google search engine for example : google.es

or is it only working for google.com?

Thanks for helping.

It is possible, and there are a few ways to do it.

See this entry on Googles AJAX API blog.

There are three possible ways to implement, depending on how you're using the API:

  1. If you use the loader, you can simply load jsapi on the domain you're interested in (example), such as:

  2. Alternately, you can set this with the web search object's .setRestriction method (example):

    var ws = new google.search.WebSearch(); ws.setRestriction(google.search.Search.RESTRICT_EXTENDED_ARGS, {'gl' : 'es'});

  3. Finally, if you're using the RESTful interface, all you have to do is append a "gl" URL parameter to your request:

    http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=flowers&gl=fr