p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Web Programming > JavaScript > BOOK: Professional Ajax ISBN: 978-0-471-77778-6
I forgot my password Register Now
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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 28th, 2006, 01:44 PM
Registered User
 
Join Date: Oct 2006
Location: delhi, delhi, India.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to shalesh
Default Best Picks Revisited - Example not working

I downloaded the chapter 4 example "Best Picks Revisited" from book Professional Ajax. As specified in the book i created a directory with name booklists in wwwroot folder on my machine which has iis as web server. Now when i run url "http://localhost/booklists/book.htm" in IE version 6 or mozilla firefox version 1.5, i get the error message "your browser doesn't support an XML HTTP Request." It is very frustrating for me as none of the examples from chapter 4 is working on my machine.

Please guide me what exactly is the issue and how that issue can be resolved. An early replay in this regard would be most appreciated.

Regards
Shalesh
__________________
shalesh
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old October 29th, 2006, 01:31 PM
jmcpeak's Avatar
Wrox Author
Points: 130, Level: 2
Points: 130, Level: 2 Points: 130, Level: 2 Points: 130, Level: 2
Activity: 10%
Activity: 10% Activity: 10% Activity: 10%
 
Join Date: Nov 2005
Location: , Texas, USA.
Posts: 33
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Shalesh,

Try downloading a newer version of zXml (current version is 1.0.2) from http://www.nczonline.net/downloads/.

------------------------
Jeremy McPeak
Author, Professional Ajax
http://www.wdonline.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old November 1st, 2006, 07:16 AM
Registered User
 
Join Date: Oct 2006
Location: delhi, delhi, India.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to shalesh
Default

Thanks for the reply. I downloaded the latest zxml.js from the location you specified. The example is running fine in both IE and mozilla. I am facing problem if i am implementing the example in another xslt file which is getting transformed on server side and the xslt code is given below.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Ajax Exercise</title>
    <script type="text/javascript" src="/zapak/js/zxml.js"></script>
    <script type="text/javascript">
    <![CDATA[
        function init(sFilename) {
            var oReq = zXmlHttp.createRequest();
            oReq.onreadystatechange = function () {
                if (oReq.readyState == 4) {
                    if (oReq.status == 200) {
                        transformXml(oReq.responseText);
                    }
                }
            };
            oReq.open("GET", sFilename, true);
            oReq.send();
        }

        function transformXml(sResponseText) {
            var oXmlDom = zXmlDom.createDocument();
            oXmlDom.async = false;
            oXmlDom.loadXML(sResponseText);
            var oXslDom = zXmlDom.createDocument();
            oXslDom.async = false;
            oXslDom.load("/xslshow.z?path=/testplayani");
            var str = zXslt.transformToText(oXmlDom,oXslDom);
            document.getElementById("divBookList").innerHTML = str;
        }
      ]]>
    </script>
</head>
<body onload="init('/topbarxml.z')">
    <div id="divBookList"></div>
</body>
</html>
    </xsl:template>
</xsl:stylesheet>


It is working fine in IE but it doesn't work in mozilla firefox version 1.5.0.7 . i get following errors in java script console....

Error: uncaught exception: Permission denied to call method Location.toString

Error: event.target.rel has no properties
Source File: chrome://global/content/bindings/tabbrowser.xml
Line: 791

Error: uncaught exception: [Exception... "Not enough arguments [nsIXMLHttpRequest.send]" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: http://test2.zapak.com/zapak/js/book.htm :: init :: line 59" data: no]

please help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old November 1st, 2006, 09:45 AM
Registered User
 
Join Date: Oct 2006
Location: delhi, delhi, India.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to shalesh
Default

Sorry there was a mistake in my above message ...The sample code doesn't work in mozilla firefox version 1.5.0.7. it gives following error

Error: uncaught exception: [Exception... "Not enough arguments [nsIXMLHttpRequest.send]" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: http://localhost/booklists/book.htm :: init :: line 19" data: no]

Regards
Shalesh
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #5 (permalink)  
Old November 1st, 2006, 10:12 AM
joefawcett's Avatar
Wrox Author
Points: 8,994, Level: 40
Points: 8,994, Level: 40 Points: 8,994, Level: 40 Points: 8,994, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 2,922
Thanks: 0
Thanked 13 Times in 12 Posts
Default

Mozilla's XMLHttpRequest needs an argument passed to the send method, even if it's an empty string or null. I thought that had been added to the zXml library but obviously not.
Try changing
Code:
oReq.send();
to
Code:
oReq.send("");

--

Joe (Microsoft MVP - XML)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #6 (permalink)  
Old November 1st, 2006, 12:24 PM
jmcpeak's Avatar
Wrox Author
Points: 130, Level: 2
Points: 130, Level: 2 Points: 130, Level: 2 Points: 130, Level: 2
Activity: 10%
Activity: 10% Activity: 10% Activity: 10%
 
Join Date: Nov 2005
Location: , Texas, USA.
Posts: 33
Thanks: 0
Thanked 2 Times in 2 Posts
Default

This is my fault. Code in the text, or in the examples, omitted the vital argument to the send() method.

Since you're doing a GET request, you should pass null to the send() method.

Code:
oReq.send(null);
That'll fix up the NS_ERROR_XPC_NOT_ENOUGH_ARGS error.


------------------------
Jeremy McPeak
Author, Professional Ajax
http://www.wdonline.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #7 (permalink)  
Old November 3rd, 2006, 10:40 AM
Registered User
 
Join Date: Oct 2006
Location: delhi, delhi, India.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to shalesh
Default

Dear Jeremy,

Thanks for the help. I have a question which is related to doing multiple xml and xsl transformation using the function you have provided in the book "Professional Ajax" For example in my html page i use following piece of code...

<html>
<head>
 <script type="text/javascript" src="zxml.js"></script>
    <script type="text/javascript">
        function init(sFilename) {
            var oReq = zXmlHttp.createRequest();
            oReq.onreadystatechange = function () {
                if (oReq.readyState == 4) {
                    // only if "OK"
                    if (oReq.status == 200) {
                        transformXml(oReq.responseText);
                    }
                }
            };
            oReq.open("GET", sFilename, true);
            oReq.send();
        }

        function transformXml(sResponseText) {
            var oXmlDom = zXmlDom.createDocument();
            oXmlDom.async = false;
            oXmlDom.loadXML(sResponseText);


            var oXslDom = zXmlDom.createDocument();
            oXslDom.async = false;
            oXslDom.load("books.xsl");

            var str = zXslt.transformToText(oXmlDom,oXslDom);
            document.getElementById("divBookList").innerHTML = str;
        }

       </script>
</head>
<body onload="init('thisweekbooks.xml')">
<table>
<tr>
<td>
<div id="divBookList"></div>
</td>
<td>
    <div id="otherlist"></div>
<script language="javascript">
init('thisweekbooks.xml');
</script>
</td>
</tr>
</table>
</body>
</html>

In mozilla i get the following error....

Error: uncaught exception: Permission denied to call method Location.toString

(1) if i need to transform more than 1 xml using same xslt, how do i do it?
(2) if i need to transform more than 2 xml and each xml uses different xslt, how do i do it?

please help....

shalesh
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CalculatorWrapper Revisited RJMiller BOOK: Real World SharePoint 2007 (SharePoint MVP) ISBN 978-0-470-16835-6 3 September 4th, 2008 04:06 PM
Insert Issue revisited cedwards Dreamweaver (all versions) 13 June 21st, 2005 04:02 PM
.Net Windows Services Revisited - Help Rhonda Fischer General .NET 0 September 1st, 2004 01:36 PM
Position On PostBack revisited Colonel Angus ASP.NET 1.1 1 June 14th, 2004 03:01 PM
Excel Text Imports Revisited bph Access 5 April 1st, 2004 07:35 AM



All times are GMT -4. The time now is 12:27 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc