JSFiddle - React, Tailwind, and code Playground

by rjurd

HTML

<div id='results'>Waiting...</div>

JavaScript

var my_request = new Request({
    url: 'http://filedb.experts-exchange.com/incoming/2011/02_w08/409497/books.xml',
    method: 'get',
    onSuccess: function(rtn, my_xml) {
        alert('success');
        window.books = $(my_xml).getElements('book');
        search_xml();
    }
}).send();

search_xml = function() {
    $('results').innerHTML = "";
    for (var i = 0; i < books.length; i++) {
        // search each book here
        var book_title = books[i].getElement('title');
        var book_match = new String(book_title.textContent).test($('xml_search').value, "i");
        if (book_match) {
            $('results').adopt(new Element('div', {
                id: 'myResult' + i,
                html: books[i].getElement('title').textContent
            }));
        }
    }
}