By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,030 Members | 2,277 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,030 IT Pros & Developers. It's quick & easy.

Cross domain calls issue in Firefox and Safari using AJAX

P: 1
Hi,

I have implemented prototype.js file to use AJAX calls in my application. I need to call cross domain to get some value from different server. The HTML and prototype file are hosted in https://wwww.myserver.xyz.com.I need to call other sever which URL ends with same as my server xyz.com (https://wwww.otherserver.xyz.com)

The below mentioned code is working fine only in IE browser, But it is not working in Firefox and Safari browsers.Could you please assist me?.Your help is very appreciated.

Thanks a lots,
Saravanan

Sample Code:

Expand|Select|Wrap|Line Numbers
  1.     function loadResponse()
  2.     {
  3.         //This my sever where html and js files are hosted
  4.         //https://wwww.myserver.xyz.com;
  5.  
  6.         //need to call other sever which URL ends with same xyz.com
  7.         var url = 'https://wwww.otherserver.xyz.com'
  8.  
  9.         document.domain ='xyz.com';
  10.  
  11.         new Ajax.Request(url,
  12.         {
  13.             method:'get', onSuccess: function(transport)
  14.             {
  15.                 response = transport.responseText || "no response text";
  16.                 parseResponse();
  17.             },
  18.             onFailure: function()
  19.             {
  20.                 parseAlternativeResponse();
  21.             }
  22.         });
  23.  
  24.     }
Oct 25 '08 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
See same origin policy. Is it four Ws and can it not be a single domain?
Oct 26 '08 #2

Post your reply

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