Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Ajax ISBN: 978-0-471-77778-6
This is the forum to discuss the Wrox book Professional Ajax by Nicholas C. Zakas, Jeremy McPeak, Joe Fawcett; ISBN: 9780471777786
Important: For the new 2nd edition of this book, please post here instead: [url="http://p2p.wrox.com/forum.asp?FORUM_ID=307"]http://p2p.wrox.com/forum.asp?FORUM_ID=307[/url]
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Ajax ISBN: 978-0-471-77778-6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 11th, 2006, 12:39 PM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default book.htm problem in chapter 04

I tested book.htm, but didn't get correct result, try debug and found:

function init(sFilename) {
    var oReq = zXmlHttp.createRequest();
    oReq.onreadystatechange = function () {
        alert(oReq.readyState)
        if (oReq.readyState == 4) {
            // only if "OK"
            alert(oReq.status)
            if (oReq.status == 200 || oReq.status == 0) {
                transformXml(oReq.responseText);
            }
        }
    };
    oReq.open("get", sFilename, true);
    oReq.send();
}


in FireFox "oReq.readyState" always show 1, and IE "oReq.status" only show 0. I use Firefox 1.0.7 and IE 6.0. Can anybody give me some help?

Thanks
Reply With Quote
  #2 (permalink)  
Old May 11th, 2006, 05:49 PM
jmcpeak's Avatar
Wrox Author
Points: 467, Level: 7
Points: 467, Level: 7 Points: 467, Level: 7 Points: 467, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2005
Location: , Texas, USA.
Posts: 87
Thanks: 0
Thanked 18 Times in 17 Posts
Default

A couple of things. First, and it's my fault that it is this way, oReq.send() should be oReq.send(null).

Secondly, how are you running this? Are you double clicking the .htm file?

In order for it to work properly, you must run the file off a web server. If you're running Windows 2000 or XP Pro, you can install IIS, place the .htm file (and other supporting files) in the c:\inetpub\wwwroot\ folder and point your browser to http://localhost/book.htm. If you're not running 2000 or XP Pro, you'll have to load PWS or Apache, place the files into the folders used by the server, and point your browser to the URL I listed earlier.

If neither of those solutions work, come back and we'll go from there.

------------------------
Jeremy McPeak
Author, Professional Ajax
http://www.wdonline.com
Reply With Quote
  #3 (permalink)  
Old May 15th, 2006, 07:16 PM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the help, now I am running on server, I can tell the oReq.status is 200, the only thing didn't work is
var str = zXslt.transformToText(oXmlDom,oXslDom);
the value of str is blank, from alert(sResponseText), it shows the xml data. I just don't know how to check
oXmlDom.loadXML(sResponseText); and
oXslDom.load("books.xsl");

Thanks

Reply With Quote
  #4 (permalink)  
Old May 15th, 2006, 08:22 PM
nzakas's Avatar
Wrox Author
 
Join Date: Dec 2004
Location: Peabody, MA, USA.
Posts: 217
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You should check the value of the DOMs using the xml property:
Code:
alert(oXmlDom.xml);
alert(oXslDom.xml);
Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)
http://www.nczonline.net/
Reply With Quote
  #5 (permalink)  
Old May 16th, 2006, 11:58 AM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It is working now, Thanks

Reply With Quote
  #6 (permalink)  
Old May 16th, 2006, 06:22 PM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Mr. Zakas,

My test only work for IE

alert(oXmlDom.xml)
alert(oXslDom.xml)

with FireFox alert(oXmlDom.xml) shows the content, but
alert(oXslDom.xml) return blank. I am not sure what is wrong, and how to debug oXslDom for FireFox.

Thanks

James

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Upload_image.htm Chapter 7 jeroen BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 2 September 3rd, 2009 11:53 AM
chapter 04 - table01 pannet1 BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 September 14th, 2005 06:19 AM
chapter 04 - table01 pannet1 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 September 14th, 2005 01:21 AM
Beginning Visual C# Exercises - Chapter 04 seblake C# 0 July 21st, 2004 09:21 AM



All times are GMT -4. The time now is 01:54 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.