Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

47 lines (37 sloc) 0.865 kB
<style>
#imgs img {
display: inline;
margin: 10px;
}
</style>
<p>
When fetching, the failure alert should only fire on script timeout. Also, onSuccess should not fire on timeout.
</p>
<button id="a">1000 ms timeout</button>
<button id="b">5000 ms timeout</button>
<hr/>
<div id="imgs"></div>
<script src="/depender/build?require=More/Request.JSONP,Core/Element.Event"></script>
<script>
$('a').addEvent('click', request.bind(this,1000));
$('b').addEvent('click', request.bind(this,5000));
function request(timeout){
new Request.JSONP({
log: true,
data: {
delay: 1
},
timeout: timeout,
url: '/echo/jsonp',
onFailure: function(){
alert("this request failed");
},
onTimeout: function(){
alert("this request timedout");
},
onSuccess: function(data){
alert('this request completed successfully');
}
}).send();
}
</script>
Jump to Line
Something went wrong with that request. Please try again.