Php jqueryajax-can';我没有得到答复

Php jqueryajax-can';我没有得到答复,php,json,jquery,Php,Json,Jquery,我正在使用jQuery.ajax: var url = "http://client.my_url.com/test_get_account_data.php"; jQuery.ajax({ type: "GET", url: url, cache: false, success: function(resultsData){ alert("We're finally making the call."); }, error:f

我正在使用jQuery.ajax:

var url = "http://client.my_url.com/test_get_account_data.php";  
jQuery.ajax({
    type: "GET",
    url: url,
    cache: false,
    success: function(resultsData){
        alert("We're finally making the call.");
    },
    error:function (jqXHR, textStatus, errorThrown){
        alert("Error:" + textStatus+ "," + errorThrown);
    } 
});
要点击此php脚本:

<?php
header("Content-Type: text/plain");

$myFile = "LogFile.log";
$fh = fopen($myFile, 'w');

$accountJSON = array("id"=>"Level 3.accountName","type"=>"Level 3","name"=>"accountName","total"=>"1059.25","in"=>"8603.56","out"=>"7544.31");

$encodedResponse = json_encode($accountJSON);

fwrite($fh, "We're at the end of get_account_data with encodedResponse:\n");
fwrite($fh, $encodedResponse."\n");

echo $encodedResponse;
?>

您似乎正在尝试呼叫
http://client.my_url.com
使用AJAX获取来自
http://localhost:8080


根据浏览器的种类,您不能向另一个域发送AJAX GET/POST请求。您需要使用跨域AJAX。

浏览器的Javascript错误控制台会说什么?您的网页与PHP服务器在同一个域上吗?浏览器的错误控制台或调试控制台是否报告任何javascript错误或安全错误?尝试
标题(“内容类型:application/json”)?您实际上并没有发回纯文本,是吗?不要使用完整的url,只要使用/dir/a/b/c/file.php检查日志,如果您使用的chromeJavascript错误控制台(firefox)没有错误。有警告,但这些似乎都是来自jQueryUICSS问题。firebug中的net选项卡的请求头有以下内容:GET/test\u GET\u account\u data.php?=133149975860 HTTP/1.1主机:client.sweepscoach.com用户代理:Mozilla/5.0(X11;Ubuntu;Linux x86\u 64;rv:10.0.2)Gecko/20100101 Firefox/10.0.2接受:/Accept语言:en-us,en;q=0.5接受编码:gzip,deflate连接:保持活动引用:来源:我可以将传输作为纯文本吗?JSONP不允许非异步调用,我需要进行的一个调用需要这样做。我进行了更改,使响应标题具有:“Content-Type:text/plain”,并在ajax调用中添加了“dataType:'text',”参数,但它似乎仍然没有返回任何内容(我花了比我愿意承认的更长的时间让JSONP工作,但现在是。如果其他人最终面临这个问题,请到这里进行更多的演练:
We're at the end of get_account_data with encodedResponse:<br/>
{"id":"Level 3.accountName", "type":"Level 3", "name":"accountName", "total":"1059.25", "in":"8603.56", "out":"7544.31"}