Request.HTML
Sends HTML code to backend updates target div and executes <script>
by Dimitar Christoff
HTML
<div id='target'>container</div>
CSS
body {
font-family: Helvetica, Sans, Arial;
}
p {
padding: 10px;
}
JavaScript
new Request.HTML({
url: '/echo/html/',
data: {
html: "loaded content is now in",
delay: 3
},
method: 'post',
onRequest: function() {
document.id("target").set("html", "Loading content...");
},
onComplete: function() {
var response = this.response.text;
document.id("target").set("tween", {
onComplete: function() {
this.element.set("html", response);
this.removeEvents("complete");
this.element.fade(1);
}
}).fade(0);
}
}).send();