Results 1 to 2 of 2

Thread: How to access cross domain using JSON ajax

  1. #1
    Join Date
    May 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to access cross domain using JSON ajax

    hello

    Question:

    i get "Access denied" error.Can anyone convert the code below in JSON i need to

    access data from some other domain. OR any other fully explained efficient method to access

    cross domains plz.

    ---------js file--------------

    Code:
    window.onload=makeRequest;
    
    function makeRequest() 
    {
            var http_request={};    
            if (window.XMLHttpRequest) 
            { // Mozilla, Safari,...
                http_request = new XMLHttpRequest();
            } 
            else 
            {
                http_request=new ActiveXObject("Msxml2.XMLHTTP");   
            }
                
            http_request.open("GET", "http://www.uclocal.com/LX-U.aspx?", false);
            http_request.onreadystatechange=function()
            {
                if(http_request.readyState==3)
                {
                alert("data is loading...please wait");
                }
                else
                if(http_request.readyState==4)
                {
                    if(http_request.status==200)
                    {
                        document.write(http_request.responseText);
                    }
                }       
             }    
            http_request.send();
    }
    Last edited by Snookerman; 05-08-2009 at 01:08 PM. Reason: added [code] tags

  2. #2
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    By default ajax does not allow cross-domain access.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •