Wrox Programmer Forums
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
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
 
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
 
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

 
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/
 
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

 
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





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.