View Full Version : ajax function undefined

10-19-2010, 09:53 AM
I am writing an ajax function and while I followed the w3 tutorial I am getting an undefined error. I have already checked the file path and it is good, so the external file for the ajax function is good.

The function in question is gallerySelect()

Here is the file to it:


and the method at which I am calling it is:

<a href="#" ><img src="/gallery/thumbs/holga.png" style="opacity: 0.6; height: 120px; width: 120px;" class="gradualshine"
onmouseout="slowlow(this)" onclick="gallerySelect(1)" alt="holga"/></a>

I appreciate the help

10-19-2010, 10:17 AM
<script type="text/javascript">


<div id="myDiv"><h2>Let AJAX change this text</h2></div>
<button type="button" onclick="loadXMLDoc()">Change Content</button>
You shouldn't put the script tags or any html tags inside your external javascript file. The same rule applies to external CSS files also.

10-19-2010, 10:44 PM
Thanks for the reply, I cant believe I forgot to take that part out.

Also I took a look at console and remembered another error in code:

if (window.XMLHttpRequest)

says its a syntax error. I didnt change it from what w3 put it as. Its on line 9 at the very beginning of the gallerySelect() function

Any thoughts?