Cross domain calls issue in Firefox and Safari using AJAX

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • saravj2ee
    New Member
    • Oct 2008
    • 1

    Cross domain calls issue in Firefox and Safari using AJAX

    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:

    Code:
    	function loadResponse()
    	{
    		//This my sever where html and js files are hosted
    		//https://wwww.myserver.xyz.com;
    
    		//need to call other sever which URL ends with same xyz.com
    		var url = 'https://wwww.otherserver.xyz.com'
    
    		document.domain ='xyz.com';
    
    		new Ajax.Request(url,
    		{
    			method:'get', onSuccess: function(transport)
    			{
    				response = transport.responseText || "no response text";
    				parseResponse();
    			},
    			onFailure: function()
    			{
    				parseAlternativeResponse();
    			}
    		});
    
    	}
    Last edited by acoder; Oct 26 '08, 04:16 PM. Reason: Added [code] tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    See same origin policy. Is it four Ws and can it not be a single domain?

    Comment

    Working...