Zac
Zac

Reputation: 12836

Prototype equivalent to jQuery load

I built something using jQuerys load function to grab a specific element from another page.

Something like :

$j('#result').load('http://thesite.com .desiredClass')

What would be an equivalent type of function with prototype?

Upvotes: 4

Views: 1944

Answers (1)

Raynos
Raynos

Reputation: 169451

Look at Ajax.Request

new Ajax.Request('/your/url', {
  onSuccess: function(response) {
      var html = response.responseText;
      var div = new Element("div");
      div.innerHTML = html;
      var content = Element.select(div, ".desiredClass");
      $("content").appendChild(content);
  }
});

Afraid it's "lower level"

Upvotes: 3

Related Questions