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
Post a Comment