Provide pages for the app. Now I want to write a common js for page request timeout. Please provide ideas or cases! !
The new version of XMLHttpRequest object has a timeout attribute to control the upper limit of ajax request time.
//通常设置为0时不生效. //设置为字符串时, 如果字符串中全部为数字, 它会自动将字符串转化为数字, 反之该设置不生效. 设置为对象时, 如果该对象能够转化为数字, 那么将设置为转化后的数字. xhr.timeout = 0; //不生效 xhr.timeout = '123'; //生效, 值为123 xhr.timeout = '123s'; //不生效 xhr.timeout = ['123']; //生效, 值为123 xhr.timeout = {a:123}; //不生效 xhr.ontimeout = function(event){ alert('请求超时!'); }
jquery angularjs has timeout
The new version of XMLHttpRequest object has a timeout attribute to control the upper limit of ajax request time.
jquery angularjs has timeout