[Hacking-es] Google offers permanent hosting for major Ajax libraries

Aitor Garcia Rey aitor at linkingpaths.com
Wed May 28 08:44:53 GMT 2008


On Wed, May 28, 2008 at 9:30 AM, Andrés gutiérrez
<andresgutgon at gmail.com> wrote:
> como se invocarían estas librerías desde un proyecto Rails?


Como desde cualquier otro proyecto y segun pone el post:

1.- De manera explícita

<script src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js"></script>

2.- De manera programatica a traves del API:

<script src="http://www.google.com/jsapi"></script>
<script>
  // Load jQuery
  google.load("jquery", "1");

  // on page load complete, fire off a jQuery json-p query
  // against Google web search
  google.setOnLoadCallback(function() {
    $.getJSON("http://ajax.googleapis.com/ajax/services/search/web?q=google&;v=1.0&;callback=?",

      // on search completion, process the results
      function (data) {
        if (data.responseDate.results &&
            data.responseDate.results.length>0) {
          renderResults(data.responseDate.results);
        }
      });
    });
</script>

Como comentan en el hilo un plugin para transparentar el uso en Rails
seria trivial, tanto si conservamos la actual idiomatica:

javascript_include_tag :all, :googled => true

como con una nueva

javascript_include_tag_from_google :prototype

sidenote: Mi nombre propuesto "agax". Si alguien de la lista se pone a
desarrollarlo que avise, para no duplicar esfuerzos XD.


-- 
Kind Regards,
Aitor Garcia
Cofounder - Linking Paths
http://www.linkingpaths.com


More information about the Hacking-es mailing list