diff options
author | Christopher Baines <cb15g11@soton.ac.uk> | 2015-03-03 20:28:36 +0000 |
---|---|---|
committer | Christopher Baines <cb15g11@soton.ac.uk> | 2015-03-03 20:28:36 +0000 |
commit | b74bd4213c12d662e1146a5b3035d95ba11aaf6f (patch) | |
tree | 06c33e7c72b37b4bc777556f773b3a57fae8c570 /src/leaflet-soton.js | |
parent | 85a2dbfe03a929fff35b7c727906930922c6510c (diff) | |
download | leaflet-soton-b74bd4213c12d662e1146a5b3035d95ba11aaf6f.tar leaflet-soton-b74bd4213c12d662e1146a5b3035d95ba11aaf6f.tar.gz |
Cope with more failure states in the XMLHTTPRequest
Previously, the callback would not be called if the status was not 200.
Diffstat (limited to 'src/leaflet-soton.js')
-rw-r--r-- | src/leaflet-soton.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/leaflet-soton.js b/src/leaflet-soton.js index 0948789..ba5a138 100644 --- a/src/leaflet-soton.js +++ b/src/leaflet-soton.js @@ -1746,8 +1746,12 @@ SELECT * WHERE {\ xhttp.send(options.data); xhttp.onreadystatechange = function() { - if (xhttp.status == 200 && xhttp.readyState == 4) { - callback(JSON.parse(xhttp.responseText), xhttp.responseText); + if (xhttp.readyState === 4) { // loaded + if (xhttp.status === 200) { + callback(JSON.parse(xhttp.responseText), xhttp.responseText); + } else { + callback(null); + } } }; } |