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

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

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

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

November 1st, 2006, 10:12 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 2,922
Thanks: 0
Thanked 13 Times in 12 Posts
|
|
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 to
--
Joe ( Microsoft MVP - XML)
|

November 1st, 2006, 12:24 PM
|
 |
Wrox Author
|
|
Join Date: Nov 2005
Location: , Texas, USA.
Posts: 33
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
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.
That'll fix up the NS_ERROR_XPC_NOT_ENOUGH_ARGS error.
------------------------
Jeremy McPeak
Author, Professional Ajax
http://www.wdonline.com
|

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
|
|
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
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |