Request.HTML with auto-reSend
Request.HTML with auto-reSend. Perfect for push notification systems.
by Oski Krawczyk
HTML
<div id="target">Target</div>
JavaScript
Request = Class.refactor(Request, {
onSuccess: function(){
this.previous();
this.observe.delay(this.options.observeDelay, this);
},
observe: function(){
if (this.options.observeDelay){
this.send();
}
}
});
new Request.HTML({
url: '/ajax_html_echo/',
data: {
'html': "<p>A paragraph</p>"
},
method: 'post',
update: 'target',
onSuccess: function(response) {
$('target').highlight();
},
observeDelay: 1000
}).send();