SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question ajax.js from Book example

    I have the book Build Your Own Ajax Web Applications

    I have tried making the default Ajax class file (which I named main.js)
    and I get no output and no errors

    I am not sure where I went wrong

    I tested with IE6 and Firefox latest.
    Here is the code:
    http://sial.org/pbot/19704

    fakeserver.php gives me the expected output when visited directly

    here is my index.html:
    Code:
    <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
       <meta http-equiv="Content-Type"
           content="text/html; charset=iso-8859-1" />
       <title>A Simple AJAX Test</title>
       <script type="text/javascript" src="js/main.js"></script>
       <script type="text/javascript">
    var hand = function(str) {
       alert(str);
     }
     var ajax = new Ajax();
     ajax.doGet('/fakeserver.php', hand, 'text'); 
       </script>
     </head>
     <body>
     </body>
    </html>

  2. #2
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
     this.mimeType = null;
    }
    
    this.init = function() {
    It appears that you prematurely cuttoff the Ajax declaration. That brace before this.init needs to go allll the way down at the bottom. Also, use the Javascript Console in Firefox to spot errors that may have occured.

  3. #3
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cool

    well I didn't find the problem .. but thanks .. at least now I know about
    Javascript console.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •