Jquery 分析从cfquery创建的json时出错

Jquery 分析从cfquery创建的json时出错,jquery,coldfusion,cfml,Jquery,Coldfusion,Cfml,我一辈子都搞不清楚这到底是怎么回事。通常,我不会通过json从查询返回数据,但在本例中我需要这样做 以下是CFC功能: <cffunction name="f1" access="remote" returnformat="JSON" > <!---query goes here ---> <cfreturn thequery> </cffunction> 通常,我会创建一个结构,并用我想要返回的数据填充它,然后一切正常 我将其传

我一辈子都搞不清楚这到底是怎么回事。通常,我不会通过json从查询返回数据,但在本例中我需要这样做

以下是CFC功能:

<cffunction name="f1" access="remote" returnformat="JSON" >
    <!---query goes here --->
    <cfreturn thequery>
</cffunction>
通常,我会创建一个结构,并用我想要返回的数据填充它,然后一切正常

我将其传递回调用页面,并根据需要使用它,但无论出于何种原因,我似乎无法在调用页面上正确解析json。我收到
JSON.parse:意外字符错误

jQuery:

$.post("myCFC.cfc",{method:"f1"},
    function(response){
        var data = $.parseJSON(response);
        //doing stuff here, but can't parse the json, so it doesn't matter
    },
    "json");
所以,我想我应该试着只使用数据,因为在这种特殊情况下,我不关心列名。那没用,所以我现在在这里


有人能解释一下我做错了什么吗?

如果提供json数据类型,请不要使用
$.parseJSON
。jQuery将自动为您完成这项工作

$.post("myCFC.cfc",{method:"f1"},
    function(data){
        //var data = $.parseJSON(response);
        //doing stuff here, but can't parse the json, so it doesn't matter
    },"json"); // <-- here is where you supplied the json datatype
$.post(“myCFC.cfc”,{method:“f1”},
功能(数据){
//var data=$.parseJSON(响应);
//在这里做一些事情,但是不能解析json,所以这无关紧要
}“json”)//
$.post("myCFC.cfc",{method:"f1"},
    function(data){
        //var data = $.parseJSON(response);
        //doing stuff here, but can't parse the json, so it doesn't matter
    },"json"); // <-- here is where you supplied the json datatype