Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all

I am fetching data from a URL using ajax call.it is giving a json object to me.

When i run the application the page is working fine in IE with a conformation that
The Page is accessing information that is not under its control.This poses a security rick.Do you want to continue?

but that is not working in other browser like FireFox,Chrome,Safari etc.

i don't know what is the problem ...please explain me why it is occurring and how to solve the issue..??
My Code:
HTML
<html>
<head>
<script type="text/javascript">
function Search() {
            var url = "wwwourgoalplancom";
            var userInput = document.getElementById("searchInput").value;
            var searchURL = "http://192.168.9.11/userInput ";//Form this URL json formatted data is present.
            $.ajax({
                url: searchURL,
                type: 'POST',
                dataType: 'json',
                contentType: 'application/json; charset=utf-8',
                success: function (data) {
                    try {
                       alert(data);
                    }
                    catch (err) {
	    alert(err);
                    }
                }
            });
        }
</script>
</head>
<body>
	<input type="search" id="searchInput" autofocus />
        <input type="button" name="Submit" value="Search" id="btnSearch" onclick="Search()" />
</body>
</html>


data inside try is coming in IE and null in other browsers.

Please help
Thanks in advance.
Posted
Updated 15-Oct-12 3:01am
v4
Comments
ZurdoDev 15-Oct-12 9:25am    
The problem is exactly what it says. You are trying to access data across domains. IE allows the client to turn that ability on or off and I imagine the other browsers do as well.

1 solution

Please diagnosis the browser security setting , it is not an issue of your code .

Thanks,
Ambesha
 
Share this answer
 
Comments
Mac12334 16-Oct-12 0:47am    
Can you please share the browser setting..
How to allow that cross domain data??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900