Hello, I have the following code witch works fine. But I'am a newbe
and dont get what i want.
I would like to display one line out of the jason request choosen
randomly.
After that i would like to have a button to scroll to the next line.
Somebody can help??

Thanx in advance.


        var path = 'http://api.kivaws.org/v1/';
        var writehere = $('hierhin');

    var request = new Request.JSON({
                        url: path + 'lending_actions/recent.json',
                        onComplete: function(jsonObj) {
                //var rand = $random(0,
jsonObj.lending_actions.length-1);
                                //addText(jsonObj.lending_actions[rand]);
                           addText(jsonObj.lending_actions);
                        }
                }).send();

        var addText = function(addArchiv) {

        zufall =$random(0,99);
        var name = new Element('h2', {'html': 'Hallo'});

                addArchiv.each(function(item, index) {
        //if(index==zufall)
        {
                var liste = new Element('ul', {'class': 'recentlist'}).inject
(name);
        var el = new Element('li', {'html': 'index:'+index+' item:
'+item.id+'&nbsp;<a href="'+item.date+'"
class="loadMe">'+item.loan.use}).inject(liste);
        }
                });

        name.inject(writehere); // Einfügen bei id=hierhin

        };


});

Reply via email to