jquery - Error parsing json created from a cfquery -


i cannot life of me figure out going on this. normally, don't return data query via json, need in instance.

here cfc function:

<cffunction name="f1" access="remote" returnformat="json" >     <!---query goes here --->     <cfreturn thequery> </cffunction> 

here json:

{"columns":["c1"],"data":[["1"],["2"],["3"]]} 

normally, create struct, , populate data want return, , works fine.

i pass calling page, , use needed, whatever reason, can't seem json parse correctly on calling page. getting json.parse: unexpected character error

jquery:

$.post("mycfc.cfc",{method:"f1"},     function(response){         var data = $.parsejson(response);         //doing stuff here, can't parse json, doesn't matter     },     "json"); 

so, figured i'd try using data, because don't care column name in particular case. didn't work, i'm here.

could shed light on i'm doing wrong?

do not use $.parsejson if supply json datatype. jquery automatically.

$.post("mycfc.cfc",{method:"f1"},     function(data){         //var data = $.parsejson(response);         //doing stuff here, can't parse json, doesn't matter     },"json"); // <-- here supplied json datatype 

Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -