Take the 2-minute tour ×

I'm still befuddled by the NodeList object in Mootools, and I'm hoping someone can help clarify.

I'm making a simple HTML request using Request.HTML. Here's the code:

var req = new Request.HTML({
  url: my_url,
  onSuccess: function(response) { alert(response) }

On the server side, I'm just rendering some text ("here's a response", specifically). The alert shows "[oject NodeList]", and I'm wondering what methods I can call on it to get the alert to show "here's a response".

I know that alert(response[0]) shows "[object Text]". I also figured out that if I put a break line right in the middle of my onSuccess function and type (in the console) response[0] + enter, it show's my "here's a response" text. I just can't figure out how to get the alert to show "here's a response"....


share|improve this question
console.log(this.response); will show you the response property of the request object as well - some of which is a html collection, the respose tree, the raw html and the parsed javascript. –  Dimitar Christoff May 22 '11 at 10:44

1 Answer 1

up vote 0 down vote accepted

from the mootools docs:

onSuccess(responseTree, responseElements, responseHTML, responseJavaScript)

looks like you want the third argument in the onSuccess callback function. so back to your example:

var req = new Request.HTML({
  url: my_url,
  onSuccess: function(responseTree, responseElements, responseHTML) {
share|improve this answer

Your Answer


