•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 401,628 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,904 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1211 | Replies: 9
![]() |
•
•
Join Date: Mar 2007
Posts: 42
Reputation:
Rep Power: 2
Solved Threads: 0
I am trying to insert/hide a table in my page using AJAX.
Works perfectly in Firefox. IE 7 gives me "Error: Access is denied" for the following line:
Any ideas why?
Works perfectly in Firefox. IE 7 gives me "Error: Access is denied" for the following line:
xmlReq.open("GET", url, true);Any ideas why?
•
•
Join Date: Mar 2007
Posts: 42
Reputation:
Rep Power: 2
Solved Threads: 0
i have the table save in HTML format in a separate file.
i'm using an xmlHttpRequest object in firefox to retrieve it and doing this:
like i said, works in Firefox but not IE.
and yes, in the IE version im using the ActiveX object instead of the standard.
i'm using an xmlHttpRequest object in firefox to retrieve it and doing this:
div.innerHTML = xmlReq.responseText;
like i said, works in Firefox but not IE.
and yes, in the IE version im using the ActiveX object instead of the standard.
Last edited by toadzky : Feb 8th, 2008 at 1:02 am.
•
•
Join Date: Mar 2007
Posts: 42
Reputation:
Rep Power: 2
Solved Threads: 0
It doesn't ever get that far. It returns the "Access denied error" on:
xmlReq.open("GET", url, true);•
•
Join Date: Sep 2007
Posts: 81
Reputation:
Rep Power: 1
Solved Threads: 1
chances are your AJAX script is breaking down before you even get to the response text. what I would recommand is to test the script by inserting a series of alerts up to the point where you are expecting certain result. For example, when I test my AJAX code, I checked to see if my object is created by alerting the object. If it is created, then I test the readystate to see if the value is equal to 4 and so on.
can you post your entire AJAX code in here so we can look at it?
can you post your entire AJAX code in here so we can look at it?
•
•
Join Date: Mar 2007
Posts: 42
Reputation:
Rep Power: 2
Solved Threads: 0
//Quick check for AJAX functionality. Copied from w3schools.com
function MakeXMLReq()
{
var xmlHttp = null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer 6+
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
//For IE 5.5 Users
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
function getTable(info)
{
var tableDiv = document.getElementById("externalTable");
var xmlReq = MakeXMLReq();
xmlReq.onreadystatechange = function()
{
if (xmlReq.state = 4)
{
try
{
tableDiv.innerHTML = xmlReq.responseText;
tableDiv.innerHTML += "<br /> <a href = \"#top\" onclick = \"hideDiv()\" class = \"internal text-center\">Hide Table</a>";
tableDiv.style.display = "inline";
}
catch (ex)
{
alert("Error: Unable to display AJAX retrieved table.");
return;
}
}
}
var url = info + "_table.html";
xmlReq.open("GET", url, true);
xmlReq.send(null);
}•
•
Join Date: Sep 2007
Posts: 81
Reputation:
Rep Power: 1
Solved Threads: 1
One problem that I noticed right away is that your getTable() method is evaluating the the state of xmlReq within the if statement but you are assigning it a value of 4 rather than evaluating it to 4. So make this correction and try to run the script again.
Second, I am not sure that you can use the word state instead of readystate, so you might want to experiment to see which on works.
While you are working on the aforementioned fix, I'll try to see what else is wrong with the code.
if(xmlReq.state == 4)
While you are working on the aforementioned fix, I'll try to see what else is wrong with the code.
> It doesn't ever get that far. It returns the "Access denied error" on:
Are you trying to make cross domain calls? What kind of URL are you using in your call anyways? Does it belong to your domain?
Are you trying to make cross domain calls? What kind of URL are you using in your call anyways? Does it belong to your domain?
"I don't accept change. I don't deserve to live."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
ajax asp cross-browser javascript menu with few lines of code developer development firefox home html internet javascript javascript smooth scrolling scroll smoothly window document position javascript tab menu with rounded corners generator microsoft msdn office prevent javascript menu from getting hidden under flash movies site software sql vista web
- problems with Spry/Ajax (JavaScript / DHTML / AJAX)
- Ajax javascript test if image file exists (JavaScript / DHTML / AJAX)
- returning array from ajax.responseText? (JavaScript / DHTML / AJAX)
- Using Ajax.Updater in IE (JavaScript / DHTML / AJAX)
- ajax won't work without the www in url (JavaScript / DHTML / AJAX)
- Urgent help needed regarding executing Scripts in AJAX response (JavaScript / DHTML / AJAX)
- Issue with Javascript embedded in C# (ASP.NET)
- listbox--issue php (PHP)
- My games still arent working. (Troubleshooting Dead Machines)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Problem Getting the ID of an element
- Next Thread: Call PHP webservices with Ajax



Linear Mode