Jump to content

Ajax notepad: making it work ..HELP!!


Jeathrow

Recommended Posts

Hello everyone, I found this script on the internet, and is pretty damn amazing. What ever you type in, it automatically gets stored in the notepads.But when I used the code, I get an error box message saying "processXMLDoc : Unknown"I plan to use it for my college website, but I have no clue as to what to do to fix it.Following is the code:First the index.htm

<html> <head> <meta name='keywords' content='Web,JavaScript,Scratch,Pad,Note'> <script language="JavaScript" src="AJAXRequest.js"></script> <script language="JavaScript" src="ScratchPad.js"></script> <style type='text/css'> body {    font-family: Arial, Verdona, Helvetica;    font-size: 11pt; } </style> </head> <body> Instructions: Press the <b>Add</b> button to create a new scratch pad.  Use <b>Show All</b> to show scratch pads you had previously hidden<br> using the menu provided.  System automatically handles saving entries.<br><br> <input onclick="java script: addSP('', event);" value="Add" type="button">    <input type='button' value='Show All' onclick="java script: unhideSPs();"> </body> </html>

Next, the AJAXRequest.jshttp://www.b3ta.cr3ation.co.uk/data/js/AJAXRequest.jsAnd the scratchpad.jshttp://www.b3ta.cr3ation.co.uk/data/js/ScratchPad.jsI get an error box message saying "processXMLDoc : Unknown"I presume that might be related to AJAXRequest.js, maybe somewhere in the following code:

 *	<body onload="req.loadXMLDoc('http://localhost/MonkeySite/workerPage.cfm?theAge=41');">

Here s the trial page I set up which links to the above described .js files:http://www.b3ta.cr3ation.co.uk/data/htm/scratchpad.htmThis is the original page ON A DIFFERENT SERVER containing the script, which works perfectly:http://dkpinteractive.ath.cx/ScratchPad/ScratchPad.htmIs there any way I can set up a different .cfm file, or view the original one??What should I do to fix the error? HELP!thanks in advance.. Jeathrow

Link to comment
Share on other sites

As far as I know, you can't make requests across servers. If your page is at http://www.b3ta.cr3ation.co.uk/data/htm/scratchpad.htm and you are attempting to get at http://localhost/MonkeySite/workerPage.cfm?theAge=41 using AJAX, your code will break.Either host the scratchpad.htm file on your localhost or move your workerPage.cfm to b3ta.cr3ation.co.uk.EDIT: Looking further at http://dkpinteractive.ath.cx/ScratchPad/ScratchPad.htm, the AJAX request is going to http://dkpinteractive.ath.cx/ScratchPad/ScratchPad.php. The version at http://www.b3ta.cr3ation.co.uk/data/htm/scratchpad.htm appears to be attempting to send the request to http://www.b3ta.cr3ation.co.uk/data/js/ScratchPad.php. So cross-browser scripting doesn't appear to be the problem. The problem appears to be that you don't have a file at http://www.b3ta.cr3ation.co.uk/data/js/ScratchPad.php.

Link to comment
Share on other sites

Hey,I tried with the php file:http://scratchpad.50webs.com/ScratchPad.phpI now get an error saying "processXMLDoc - Content type of text/plain; charset=iso-8859-1 not handled!"here is the Index.htm:http://scratchpad.50webs.com/index.htmOther files:http://scratchpad.50webs.com/AJAXRequest.jsandhttp://scratchpad.50webs.com/ScratchPad.phpI think i'm close, but still getting that error. What does the error mean and how can I get rid of it to get the pad working?thanks. Jeathrow

Link to comment
Share on other sites

There's a function in your AJAXRequest.js that checks the content-type of the response:

function isViableXML() {	return (this.isContentType('text/html') ||			this.isContentType('text/xhtml') ||			this.isPureXML()	);}

This function is returning false because it is looking for "text/html" or "text/xhtml" and it is finding "text/plain; charset=iso-8859-1". That's what is causing your current error (in your processXMLDoc() function).Maybe if you changed the function to:

function isViableXML() {	return (this.isContentType('text/html') ||			this.isContentType('text/plain') ||			this.isContentType('text/xhtml') ||			this.isPureXML()	);}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...