0

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--------------

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();
}
2
Contributors
1
Reply
3
Views
8 Years
Discussion Span
Last Post by ShawnCplus
0

It's a security feature on browsers, cross-domain AJAX isn't allowed and would be a big issue if it was. If you need to get data from another website use an AJAX call to call a local file which uses cURL or something similar to fetch the file.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.