开发者

Using mootools request.html to load id element from external page

My question is similiar to this question How do you grab an element from a remote page using MooTools and Request.HTML?

I unfortunately am not familiar with mootools at all but am being forced to use it as a number of other components on the website rely on this framework.

I am trying to grab an element from an external page and insert that into a div on my page.

In jquery this is nice and easy $('#result').load('ajax/test.html #container');

The above question grabs an element but I don't see how to insert that content into my pages div.

I also need the element to reload the content every 30s开发者_运维问答ec which I have absolutely no idea how to achieve this using mooTools.

Thanks

Tim


var periodical;
var myRequest = (function() {
    new Ajax('link/to/html',{
    method: 'post',
        evalScripts: false, update: $('id_of_element_to_load_contents_to'),
    onStart: $('loaderDiv').setHTML(loader)
            //^ this part just specifies an optional image to indicate loading at the loaderDiv

    }).request();
});

window.addEvent('domready',function(){
    myRequest();
    periodical = fx.periodical(30000);
});

that's how you do it for 1.11

edited: just added the function to do the ajax request every 30 seconds

i assume the reason why the call doesnt even fire is because it isnt placed inside a domready function, it does not happen like in jquery where you simply place them inside a:

$(function() {});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜