473,371 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,371 software developers and data experts.

SOP problem in AJAX especially with IE

RamananKalirajan
608 512MB
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>Prototype GET Example</title>
<script type="text/javascript"src="prototype.js"></script>
<script type="text/javascript">
function requestCustomerInfo() {
var sId = document.getElementById("txtCustomerId").value;
var oOptions = {
method: "get",
onSuccess: function (oXHR, oJson) {
displayCustomerInfo(oXHR.responseText);
},
onFailure: function (oXHR, oJson) {
displayCustomerInfo("An error occurred: " +
oXHR.statusText);
},
onException: function (oXHR, oJson) {
displayCustomerInfo("An Exception occurred: " +
oXHR.statusText);
}
};
var oRequest = new Ajax.Request("demo1.html", oOptions);
}
function displayCustomerInfo(sText) {
var divCustomerInfo = document.getElementById("divCustomerInfo");
divCustomerInfo.innerHTML = sText;
}
</script>
</head>
<body>
<p>Enter customer ID number to retrieve information:</p>
<p>Customer ID: <input type="text" id="txtCustomerId" value="" /></p>
<p><input type="button" value="Get Customer Info" onclick="requestCustomerInfo()" /></p>
<div id="divCustomerInfo"></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
Aug 8 '08 #1
5 2494
acoder
16,027 Expert Mod 8TB
If it's from the same server/directory, it won't be a same origin policy error.

If you access the demo1.html file directly, are there any problems?
Aug 9 '08 #2
RamananKalirajan
608 512MB
If it's from the same server/directory, it won't be a same origin policy error.

If you access the demo1.html file directly, are there any problems?
Yes, Mr. Acoder. It's showing an Exception namely Access Denied. I read about the Access Denied in google, from there i got it was due to SOP. You just try this code.

Regards
Ramanan Kalirajan
Aug 11 '08 #3
acoder
16,027 Expert Mod 8TB
No, I meant directly without using Ajax.
Aug 11 '08 #4
RamananKalirajan
608 512MB
No, I meant directly without using Ajax.
Thanks Mr. Acoder, the code is working when it is run with a help of server. The server is responsible for classifying the errors. So my code is working good for on404 and other error cases also. My problem solved I am movind ahead over that. Thank you very much.

Regards
Ramanan Kalirajan
Aug 12 '08 #5
acoder
16,027 Expert Mod 8TB
Glad to hear that you've got it working (even if a little unexpected ;))
Aug 12 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Matt Kruse | last post by:
In the past couple of weeks, I've heard a number of references to the term "Ajax". A fellow developer asked me if we should use ajax on a web app, and I asked "what is that?" "Oh, it's a brand...
2
by: Larry | last post by:
I am wondering if anyone has any thoughts on the following issues once Ajax is incorporated into a page: Now that we have this Ajax stuff, users have the potential to not leave a page for a long...
4
by: VK | last post by:
Google Trends is an all new service (started May 10) and I have not responsability for proper query or data accuracy. Overall seems pretty close to what could be observed by the post history in...
1
by: codefragment | last post by:
Hi I have asked this on the official asp.net forums but no luck so thought I'd try here Assume you have a page with a filter control and a grid view and many other controls on it. When the...
1
by: tysu | last post by:
When I visit programming talk I find out a hot topic talking about Levyo Ajax Technology Gallery. Their site is at http://levyo.com - demo at http://gettingzone.com. They build Ajax application on...
17
by: Arjen | last post by:
Hi, I want to reload 2 divs at one click. Ive tried: <a href = "javascript:void(0);"...
8
by: BillE | last post by:
I have an existing asp.net 2.0 webforms app using master/content pages, and it works fine. I added some Ajax elements, including some UpdatePanels and modal PopUp panels which contain asp.net...
8
by: Bill Gower | last post by:
I have a webapp that uses the AjaxControlToolkit. The app and ajax works fine when run within my dev server in Visual Studio 2005 but does not work on IIS. Any Suggestions? Bill
2
by: KBS Tours Development | last post by:
Hi, I've deployed latest release on production with new AJAX functionality but the server posts back completely and toolkit functionalities are not working at all like calendar etc. Here is...
4
by: ton | last post by:
Hi, I wander what to do. I'm developing a webapplication. One of the parts is to show records from a database. To modifiy a value, text of relational link or date I would like to use Ajax where...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.