I have made a very simple index.php code as following
<!DOCTYPE html>
<head>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/httpGet.js"></script>
<script type="text/javascript" src="js/jquery.mobile.js"></script>
</head>
<body>
<input id="string" type="text"/>
<input id="button" type= "button" value="Check" />
</body>
</html>
In this HTML code we get a number fro user and call httpgGet.js file. And the httpGet.js is :
$('#button').click(function() {
var string = $('#string').val();
$.post('http://...../isprime.php',{number: string},function(data){
alert(data);
}
}
we send the user number to a isprime.php file where it checks if a user number is a prime number or not. When I say $.post('php/isprime.php',.....) it works very well, but when I want to call the isprime.php from another computer, it does not work.
I mean $.post('192.168.1.1/test/isprime.php'....) gives me a not found error.
The file exists and I am able to run the code using direct call from browser. When I type in browser 192.168.1.1/test/isprime.php the file is reachable, but from the js file, it fails. Obviously, I can ping 192.168.1.1 too. I checked the code even with FireBug and no way thorough.
I searched a lot and came a cross that Browsers do not allow cross domain call (for security purpose, I guess), but I cannot find a solution to get rid of this problem. There are something about YQL (which is a query language and I don't know if I can use it or not). Also I saw something about cULR but I am not sure if that works too.
Kindly help. I really need it. thank u very much.