Request (XML)

Sends HTML code to backend updates target div and executes <script>

by rjurd

HTML

<div id='target'><p>This text will be replaced in 3 seconds</p></div>

CSS

body {
    font-family: Helvetica, Sans, Arial;
}
p {
    padding: 10px;
}

JavaScript

new Request({
    url: '/echo/xml/',
    data: {
        xml: "<?xml version='1.0'?><display option='3'><title class='title'> Yoursite.com </title><background class='background'>Web site template </background><line class='line'> this is fun </line><line class='line'> Thank you  </line><line class='line'>mike was here again</line></display>",
        delay: 1
    },
    method: 'post',
    onSuccess: function(response) {
        $('target').set('html',response);
    }
}).send();