Ajax call not working in Firefox and Google Chrome
Hi,
I'm a newbie to jquery and am using jquery version 1.4.2 in my java application. I am trying to develop an application, where I am accessing the data available in a remote server and rendering the data in an HTML page in my local system, using an Ajax call. The code works fine in IE7 and above. However, I am facing a problem in Firefox ( version 3.5.8) and google Chrome. The following error is reported in Firefox -
Error: uncaught exception: [Exception... "Access to restricted URI denied" code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)" location: "file:///D:/jquery.js Line: 5113"]
While searching in google on this error, I have found that this occurs because Firefox's security model does not allow retrieving/accessing localhost resources.Also Firefox does not allow accessing resources from other domains.The following are the source code of the html and js files -
//HTML file
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Show Content</title>
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/cmine_widget.js"></script>
</head>
<body>
<div id="contentArea"></div>
</body>
</html>
//JS file
jQuery(document).ready(function() {
$.post(
"http://subhasis:8080/JSMine/DataAnalysisServlet",
"{key:value}",
function(data) { $("#contentArea").html(data); },"html"
);
});
Is there anything that I am missing? Or, is there any other way for carrying out this functionality? Any help on this would be of great help.
Thanks in advance,
Amitava