javascript - Abort XHR on timeout event -


i want abort xhr request on timeout event, it's not working. syntax next:

var req = new xmlhttprequest(); req.open('post', url , true);  req.timeout = 5000; req.ontimeout = function () {   req.abort(); }; 

so if xhr request not finished in 5 seconds code should abort request. if write req.abort(), xhr request perform.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -