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) }
});
req.send();
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"....
Thanks
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) {
alert(responseHTML)
}
});
req.send();
精彩评论