0

http://mootools.net/demos/?demo=Request.JSON

单击 时会加载 JSON 数据load JSON Data

页面打开时是否可以加载此数据(类似的功能onload

4

1 回答 1

2
<head>
    <script type="text/javascript">
    window.addEvent("domready",function(){
        var request = new Request.JSON({
            url: '/echo/json/',
            onRequest: function(){
                gallery.set('text', 'Loading...');
            },
            onComplete: function(jsonObj) {
                gallery.empty();
                addImages(jsonObj.previews);
            },
            data: { // our demo runner and jsfiddle will return this exact data as a JSON string
                json: JSON.encode(data)
            }
        }).send();

    });
    </script>
</head>
于 2013-01-03T08:14:18.323 回答