I am having problem using cold fusion and jquery.ajax it will throw error
JSON.parse: unexpected non-whitespace character after JSON data
this is the response in firebug {"EMPCODE":"E-00001"}
child.cfm
<cfif IsDefined("empmycode")>
<cfset myarray= getempCode(#mycode#)>
<cfoutput>#myarray#</cfoutput>
</cfif>
<cffunction name="getempCode">
<cfargument name="empcode">
<cfquery name="empQuery" datasource="#datasource#">
Select empcode from employee where empcode = '#empcode#'
</cfquery>
<cfset mystruct = StructNew()>
<cfset mystruct.empcode=#empQuery.empcode#>
<cfreturn SerializeJSON(mystruct)>
</cffunction>
parent.cfm
$.ajax({
type: 'post',
data: {empmycode:empcode},
url: 'child.cfm',
success:function(data){
var myobjc = jQuery.parseJSON(data);
console.log(myobj.empcode);
}
});
Thank you in advance