JavaScript
--
Questions
--
Followers
Top Experts
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
alert("// code for IE7+, Firefox, Chrome, Opera, Safari")
xmlhttp=new XMLHttpRequest();
alert("AFTER : // code for IE7+, Firefox, Chrome, Opera, Safari")
}
else
{// code for IE6, IE5
alert("// code for IE6, IE5")
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
alert("AFTER : // code for IE6, IE5")
alert(typeof xmlhttp); // should not be undefined
}
please take a look at jQuerys ajax section over here: http://api.jquery.com/jQuery.ajax/
personaly i use it aswell
http://www.w3schools.com/Ajax/ajax_example.asp
http://www.w3schools.com/Ajax/tryit.asp?filename=tryajax_first






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
http://social.msdn.microsoft.com/Forums/pl-PL/iewebdevelopment/thread/8c01075f-a547-476a-b6b3-cf095917537a

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
do you try accessing a document on another domain you are running the script in?
if yes, thats why.
you -cannot- access data on other domains through ajax due to some security standard nearly every browser has implemented and enabled by default.
you can just google for "ie ajax access denied" and you will see lot of people with the same problem
example: http://stackoverflow.com/questions/3470859/why-is-ie7-and-ie8-giving-me-access-denied-when-calling-jquery






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
http://msdn.microsoft.com/en-us/library/ee797612(v=cs.20).aspx
More infos here :
http://technet.microsoft.com/en-us/library/dd346862.aspx
http://developer.yahoo.com/javascript/howto-proxy.html
its an article that explains it pretty well and how you could create a workaround for this problem working for every client connecting to your site.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
<script type="text/javascript">
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","data.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
...
The first line of the XML page is:
<?xml version="1.0" encoding="utf-8"?>
there somewhere is a setting restricting access to local resources set by the security level in IE.
i may try figuring out wich setting it is but for now i will eat something.
http://stackoverflow.com/questions/436670/local-html-file-ajax-call-and-jquery-woes
just take a look at the heighest voted answer.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/XML/Q_27268927.html</title>
</head>
<body>
<script type="text/javascript">
if(window.XMLHttpRequest && navigator.appName.indexOf("Internet Explorer")<0) {
xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET","ShoeInventory.xml",false);
xmlhttp.send();
xmlDoc = xmlhttp.responseXML;
}
else {
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = "false";
xmlDoc.load("ShoeInventory.xml");
}
var a = [];
var path = "//inventory/shoes/Type";
if(document.evaluate) {
iterator = xmlDoc.evaluate(path, xmlDoc, null, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null);
var currNode = iterator.iterateNext();
while(currNode) {
if(typeof a[currNode.textContent] == "undefined") {
a[currNode.textContent] = 1;
}
else {
a[currNode.textContent]++;
}
currNode = iterator.iterateNext();
}
}
else {
try {
var nodes = xmlDoc.selectNodes(path);
for(i=0;i<nodes.length;i++) {
if(typeof a[nodes[i].childNodes[0].nodeValue] == "undefined") {
a[nodes[i].childNodes[0].nodeValue] = 1;
}
else {
a[nodes[i].childNodes[0].nodeValue]++;
}
}
}
catch(e) { alert(e) }
}
for(var i in a) {
document.write(i + " Totals:" + a[i] + " <br / >");
}
</script>
</body>
</html>
JavaScript
--
Questions
--
Followers
Top Experts
JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.