1 2 3 4 5 6 7 8 9 10 11 12 13 14
| var xhr = new XMLHttpRequest(); var url = 'http://example.com'; xhr.open('GET',url,true); xhr.onreadystatechange = function() { if (request.readyState !== 4) return; if (timeout) return; clearTimeout(timer); if (request.status === 200) { callback(request.responseText); } } xhr.send();
|