How do you grab an element from a remote page using MooTools and Request.HTML?

大憨熊 提交于 2019-12-04 20:11:35

I hopped onto the #mootools channel on irc.freenode.net and got my answer from <kamicane> himself

var req = new Request.HTML({
    onSuccess: function( responseTree, responseElements /*more*/  ) {
        // responseElements is the one I want
        //it's an array of elements which you can filter
        var f = responseElements.filter('#myFragment');

        // do stuff with my fragment

    }
}).get('/myurl');

I'm not familiar with Mootools but when digging into Request.HTML documentation found this:

Request success event: onSuccess(responseTree, responseElements, responseHTML, responseJavaScript)

and

responseElements - (array) An array containing all elements of the remote response.

Hope this would give right direction to solve your problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!