Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

Dojo 0.4 io.bind() not working on Firefox 2.0

Posted on 2006-11-22
4
Medium Priority
?
424 Views
Last Modified: 2012-05-05
Hi,

I'm hoping this is a silly issue, but I'm still assigning max points because it's urgent.

Can someone tell me why I'm getting the following (seemingly non-?)error when I call dojo.io.bind() with Dojo 0.4 in Firefox 2.0 on Win XP SP2?  The same code works fine on IE 6.  The dojo.io.bind() is calling (a local) IIS; I did verify that the a.php module does get run in both the Firefox and the IE cases.

Error message:  "error: XMLHttpTransport Error: 0"

Here's the code:

a.html
--------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
      <script type="text/javascript">
            var djConfig = { isDebug: true };
      </script>
      <script type="text/javascript" src="js/dojo/dojo.js"></script>
      <script type="text/javascript">
            dojo.require("dojo.event.*");
            dojo.require("dojo.io.*");
      </script>

      <script type="text/javascript">
            function doBind(evt)
            {
                  var bindArgs = {
                        url: "a.php",
                        load: function(type, data, evt)
                        {
                              alert("success");
                        },
                        error: function(type, err)
                        {
                              alert("error: " + err.message);
                        },
                        mimetype: "text/plain"
                  };

                  dojo.io.bind(bindArgs);
            }
      </script>

      <script type="text/javascript">
            function initEventHandlers()
            {
                  dojo.event.connect(dojo.byId("btnTest"), "onclick", "doBind");
            }
      </script>

      <script type="text/javascript">
            dojo.addOnLoad(initEventHandlers);
      </script>
</head>
<body>
      <form id="frmLogin">
            <button id="btnTest">Test</button>
      </form>
</body>
</html>

a.php
-------
<?php

// Indicate content type.
header("Content-Type: text/plain; charset=utf-8");

print("TEST MESSAGE");

?>

-----------------------------------------
As you can see, this example is really simple, and as I mentioned it works fine on IE 6.  I don't see any JS errors in the Firefox JS error console.  I hope I'm just doing something dumb.  "Works for me" is also a valid answer; then I'd like to figure out what's different between your setup and mine.

If I can provide any more info let me know, and thanks...!
0
Comment
Question by:TruthHunter
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 23

Accepted Solution

by:
rama_krishna580 earned 1500 total points
ID: 17996621
Hi,

Somewhere in dojo.io.bind stack looks like there's an edge case that isn't being handled (either by Dojo or Firefox - I'm not sure which).
http://www.ghidinelli.com/2006/07/25/dojoiobind-and-caching/
http://alex.dojotoolkit.org/?m=200512
http://www.dev411.com/blog/tag/json

R.K
0
 

Author Comment

by:TruthHunter
ID: 18159012
Wait - I did find the solution.  The problem was that the default JS event handler was still being fired in addition to doBind().  Adding a call to "preventDefault()" fixed it:

.
.
.
     <script type="text/javascript">
          function doBind(evt)
          {
               evt.preventDefault();

               var bindArgs = {
                    url: "a.php",
                    load: function(type, data, evt)
                    {
                         alert("success");
                    },
                    error: function(type, err)
                    {
                         alert("error: " + err.message);
                    },
                    mimetype: "text/plain"
               };

               dojo.io.bind(bindArgs);
          }
     </script>
.
.
.

Hope this helps someone else out there!  Points awarded to cem_turk since you bothered to reply... :^)
0
 

Author Comment

by:TruthHunter
ID: 18159022
Sorry - I meant rama_krishna580 ...!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

648 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question