~mortenoh/+junk/dhis2-detailed-import-export

« back to all changes in this revision

Viewing changes to gis/dhis-gis-geostat/mfbase/openlayers/tests/manual/ajax.html

  • Committer: larshelge at gmail
  • Date: 2009-03-03 16:46:36 UTC
  • Revision ID: larshelge@gmail.com-20090303164636-2sjlrquo7ib1gf7r
Initial check-in

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html xmlns="http://www.w3.org/1999/xhtml">
 
2
  <head>
 
3
    <title>XHR Acceptance Test</title>
 
4
    <script src="../../lib/OpenLayers.js"></script>
 
5
    <script type="text/javascript">
 
6
        var url = "ajax.txt";
 
7
        function sendSynchronous(){
 
8
            var request = OpenLayers.Request.GET({
 
9
                url: url,
 
10
                async: false,
 
11
                callback: function() {
 
12
                    document.getElementById('send_sync').value += 'request completed\n';
 
13
                }
 
14
            });
 
15
            document.getElementById('send_sync').value += 'other processing\n';
 
16
        }
 
17
        function sendAsynchronous(){
 
18
            var request = OpenLayers.Request.GET({
 
19
                url: url,
 
20
                callback: function() {
 
21
                    document.getElementById('send_sync').value += 'request completed\n';
 
22
                }
 
23
            });
 
24
            document.getElementById('send_sync').value += 'other processing\n';
 
25
        }
 
26
        function sendAndAbort(){
 
27
            var request = OpenLayers.Request.GET({
 
28
                url: url,
 
29
                callback: function() {
 
30
                    document.getElementById('send_sync').value += 'never called\n';
 
31
                }
 
32
            });
 
33
            request.abort();
 
34
            document.getElementById('send_sync').value += 'other processing\n';
 
35
        }
 
36
 
 
37
        </script>
 
38
    </head>
 
39
    <body >
 
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>
 
48
  </body>
 
49
</html>