Ticket #5734: xhrInterval.html

File xhrInterval.html, 1.0 kB (added by jburke, 4 months ago)

Test file, place in dojo/tests/_base directory.

Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
4<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5<head>
6        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
8        <title>untitled</title>
9        <script type="text/javascript" djConfig="parseOnLoad: true, usePlainJson: true" src="../../dojo.js"></script>
10        <script type="text/javascript">
11                dojo.addOnLoad(function(){
12                        setInterval(function(){
13                                dojo.xhrPost({
14                                        url: "xhrInterval.php",
15                                        content: {
16                                                'ver' : 1,
17                                                'func': 'poll',
18                                                'args': '{ "this": "that"}'
19                                        },
20                                        handleAs: "json",
21                                        timeout: 2000, // Time in milliseconds
22                                        handle: function(response, ioArgs){
23                                                if(response instanceof Error && ioArgs.xhr.status === 0){
24                                                        console.error( "WTF?");
25                                                }else{
26                                                        console.log( "normal");
27                                                }
28                                        }
29
30                                });
31                        }, 1000);
32                });
33        </script>
34</head>
35
36<body>
37
38
39</body>
40</html>