Opened 14 years ago

Closed 12 years ago

#935 closed defect (fixed)

Error event is fired twice.

Reported by: anonymous Owned by: anonymous
Priority: low Milestone: 0.9
Component: General Version: 0.3
Keywords: Cc:
Blocked By: Blocking:

Description

<html>
    <head>
        <title>Dojo: Hello World!</title>

    <!-- SECTION 1 -->
        <script type="text/javascript" src="js/dojo/dojo.js"></script>
        <!-- SECTION 2 -->
        <script type="text/javascript">
          // Load Dojo's code relating to widget managing functions
          dojo.require("dojo.widget.*");
          dojo.require("dojo.io.*");
          dojo.require("dojo.event.*");
          // Load Dojo's code relating to the Button2 widget
          dojo.require("dojo.widget.Button2");
          var firstTime = false;
          function helloPressed() {
             firstTime = true;
             dojo.io.bind({
                url: 'response.txt',
                load: function(type, data, evt){ 
                   alert(data);
                },
                error: function(type, error) {
                   alert('Error when retrieving data from the server!');
                 
                              
                }
                    });
                  
             }
 function init()
      {
        var helloButton = dojo.widget.byId('helloButton');
        dojo.event.connect(helloButton, 'onClick', 'helloPressed')
      }

      dojo.addOnLoad(init);


        </script>
    </head>

    <body>
        <button dojoType="Button2" caption="Hello World" widgetId="helloButton"/>
    </body>
</html>

The above code produce two alert boxes if the response.txt file is missing, which means the error event is fired twice.

Change History (3)

comment:1 Changed 13 years ago by dylan

Milestone: 0.5

comment:2 Changed 13 years ago by bill

I wonder if this is a file:// URL or a http:// url. Because dojo.io.bind() doesn't support file system access at all, right? At least not the xmlhttp transport.

comment:3 Changed 12 years ago by alex

Resolution: fixed
Status: newclosed

in 0.9, we only get the error callback once. Marking fixed.

Note: See TracTickets for help on using tickets.