1
<html xmlns="http://www.w3.org/1999/xhtml">
3
<title>XHR Acceptance Test</title>
4
<script src="../../lib/OpenLayers.js"></script>
5
<script type="text/javascript">
7
function sendSynchronous(){
8
var request = OpenLayers.Request.GET({
11
callback: function() {
12
document.getElementById('send_sync').value += 'request completed\n';
15
document.getElementById('send_sync').value += 'other processing\n';
17
function sendAsynchronous(){
18
var request = OpenLayers.Request.GET({
20
callback: function() {
21
document.getElementById('send_sync').value += 'request completed\n';
24
document.getElementById('send_sync').value += 'other processing\n';
26
function sendAndAbort(){
27
var request = OpenLayers.Request.GET({
29
callback: function() {
30
document.getElementById('send_sync').value += 'never called\n';
34
document.getElementById('send_sync').value += 'other processing\n';
40
<button onclick="sendSynchronous()">synchronous</button>
41
expected output: "request completed" then "other processing"<br />
42
<button onclick="sendAsynchronous()">asynchronous</button>
43
expected output: "other processing" then "request completed"<br />
44
<button onclick="sendAndAbort()">send and abort</button>
45
expected output: "other processing" (and not "never called")<br />
46
<textarea id="send_sync" rows="6"></textarea><br />
47
<button onclick="document.getElementById('send_sync').value = ''">Clear</button>