Re: 'callback' is undefined
Put the function callback above the reference to ajaxframework.js. If that doesn't work, then can you please post the source to that JS file so we can see more.
Re: 'callback' is undefined
Quote:
Originally Posted by PeejAvery
Put the function callback above the reference to ajaxframework.js. If that doesn't work, then can you please post the source to that JS file so we can see more.
Thank you for your reply.
I put the reference under and got blank page. The code of ajaxframework.js is as below:
Code:
function readXmlWithGet(urlToCall, functionToCallback)
{
var XMLHttpRequestObj = false;
if (window.XMLHttpRequest)
{
XMLHttpRequestObj = new XMLHttpRequest();
}
else if (window.ActiveObject)
{
XMLHttpRequestObj = new ActiveObject('Microsoft.XMLHTTP');
}
if (XMLHttpRequestObj)
{
XMLHttpRequestObj.open('GET', urlToCall);
XMLHttpRequestObj.onreadystatechange = function()
{
if (XMLHttpRequestObj.readyState == 4 && XMLHttpRequestObj.status == 200)
{
functionToCallback(XMLHttpRequestObj.responseXML);
delete XMLHttpRequestObj;
XMLHttpRequestObj = null;
}
}
XMLHttpRequestObj.send(null);
}
}
Re: 'callback' is undefined
I see it now. <script> must have an end tag not an end slash. This would also explain the blank page when you changed them around. It would recognize the following text as part of the script and not HTML. Change...
Code:
<script type="text/javascript" src="ajaxframework.js" />
To...
Code:
<script type="text/javascript" src="ajaxframework.js"></script>
Re: 'callback' is undefined
Thanks, PeejAvery.
I have another question, which is how I can debug javascript in Visual Studio 2005. I set breakpoint but IDE says that this breakpoint will not currently be hit.
Anybody else can tell me why?
Re: 'callback' is undefined
Well, I personally like the Error Console in Firefox. I don't work much with Visual Studio 2005. To debug in that, you need to do a multi-step process.
1. Open Control Panel.
2. Open Internet Options.
3. Select the Advanced tab.
4. Uncheck both boxes that say "Disable script debugging".
5. Go to Visual Studio 2005.
6. Click on the Debug menu.
7. Select Windows.
8. Choose Script Explorer. (CTRL-ALT-N)
Re: 'callback' is undefined
Thank you. I forget to uncheck the option in IE.
Re: 'callback' is undefined
You're welcome. Good luck with the rest of your project. :wave: