Hi those who were working in Ajax, will surely experienced with this problem. SOP - Single Origin Policy problem. I am doing a small work in Prototype Ajax. I did a sample work. When I am passing the URL to the Ajax call within the same directory. It is showing an exception "Access Denied". The cause for this exception is SOP. This occur only with the IE. Had anyone overcome this problem. If so means pls tell me that would be very helpful for me.
The sample code I worked out
[HTML]<html>
<head>
<title>Prototyp e GET Example</title>
<script type="text/javascript"src= "prototype.js"> </script>
<script type="text/javascript">
function requestCustomer Info() {
var sId = document.getEle mentById("txtCu stomerId").valu e;
var oOptions = {
method: "get",
onSuccess: function (oXHR, oJson) {
displayCustomer Info(oXHR.respo nseText);
},
onFailure: function (oXHR, oJson) {
displayCustomer Info("An error occurred: " +
oXHR.statusText );
},
onException: function (oXHR, oJson) {
displayCustomer Info("An Exception occurred: " +
oXHR.statusText );
}
};
var oRequest = new Ajax.Request("d emo1.html", oOptions);
}
function displayCustomer Info(sText) {
var divCustomerInfo = document.getEle mentById("divCu stomerInfo");
divCustomerInfo .innerHTML = sText;
}
</script>
</head>
<body>
<p>Enter customer ID number to retrieve information:</p>
<p>Customer ID: <input type="text" id="txtCustomer Id" value="" /></p>
<p><input type="button" value="Get Customer Info" onclick="reques tCustomerInfo() " /></p>
<div id="divCustomer Info"></div>
</body>
</html>[/HTML]
This piece of code is working fine with all the other browser except the IE. If u wantto test this file, pls download the prototype.js from the site http://prototypejs.org/download and have the demo1.html file within the same folder. Then only u will be able to view the change. I am not using any server kind of stuff. Any one having solution to the SOP problem pls help me out
Regards
Ramanan Kalirajan