Quantcast
Channel: Adobe Community : Unanswered Discussions - ColdFusion
Viewing all articles
Browse latest Browse all 5794

JSON.parse: unexpected non-whitespace character after JSON data

$
0
0

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


Viewing all articles
Browse latest Browse all 5794

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>