ここにtest.phpとtestserver.phpの2つのページがあります。
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);
?>
今私の問題:これらのファイルの両方が同じサーバー(localhostまたはWebサーバー)にある場合、それは機能し、alert("Success")呼び出されます。異なるサーバー上にある場合、つまり、webサーバー上のtestserver.phpとlocalhost上のtest.phpは、機能せず、alert("Error")実行中です。ajax内のURLがhttp://domain.com/path/to/file/testserver.phpに変更されても