Hi guys, I am fed up with this problem. Here is two pages, test.php and servertest.php.
test.php
<script src="scripts/jq.js" type="text/javascript"></script>
<script>
$(function(){
$.ajax({url:"testserver.php",
success:function(){
alert("Success");
},
error:function(){
alert("Error");
},
dataType:"json",
type:"get"})})
</script>
testserver.php
<?php
$arr = array("element1","element2",array("element31","element32"));
$arr['name'] = "response";
echo json_encode($arr);
?>
Now my problem, When both of these files on same server(either localhost or web server), it works and alert("Success"), If it is on different sides, I mean, testserver.php in web server and test.php on localhost, its not working, alert("Error") is executing. Even if url inside ajax have changed to http://domain.com/path/to/file/testserver.php
Please any experts, its very simple to you but not me as I am new in this field.