Skip to main content
Participant
January 16, 2023
Question

Coldfusion 2021 and JSON

  • January 16, 2023
  • 1 reply
  • 628 views

Hello all,

 

We recently upgraded to Coldfusion 2021 from a working Coldfusion 9.

 

One of the applicatons uses the jquery .ajax function and serializeJSOn in Coldfusion.  Under version 9, it all works well, and returns to the javascript an array with ROWCOUNT, COLUMNS, and DATA.  

 

Under 2021, it does not work properly.  After some research, I have changed the #SerializeJSON(goat, true)# to #SerializeJSON(goat, "Struct" )#, and tried other various things.  

 

Interestingly, the 2021 javascript is not even fired under the "success" option in .ajax.  

 

Could anyone point me in the right direction?

 

Thanks,

 

Jim

    This topic has been closed for replies.

    1 reply

    Charlie Arehart
    Community Expert
    Community Expert
    January 16, 2023

    Yes. First, in the CFML code doing that serializejson, have you done some diagnostics to output THERE what the results are, such as with a cfdump? And compare that output with what you get when running the same in CF9? (Do you still have the CF9 to test things? That would help a lot.)

     

    Second, when you call the page the way the ajax would, what is the result you see (I mean WITHOUT it doing the cfdump)?

     

    Finally, what do you see within the browser developer tools when the js code makes the jq/ajax call? You can see there in the "network" tab both the request and response. Similarly, does the "console" tab show any js error? (Indeed, does the network tab show that all the requests within the page got 200 return codes?)

     

    There may well be some change between CF9 and 2021 that explains what you're seeing, and there may be a change we could suggest. Someone may well even offer one without any additional diagnostics. But assuming they don't, I offer the ideas above to help us help you.

    /Charlie (troubleshooter, carehart. org)
    Participant
    January 16, 2023

    Hello Charlie,

     

    First off, thanks for the reply.  It often helps to talk things through.

     

    Yes, I tried cfdumping it, but did not get any output 😞  Interestingly, even if I do a Hello<cfabort> and the top of the script, I still see nothing.  I do still have version 9 though 🙂

     

    I am not sure what you mean by calling if the way ajax does.  But, if it runs through ajax, I see that the ajax calles the error option (instead of the success), and there appears to be a "<" in the output.  I was thinking that it would mean there is a rouge "<" somewhere, but I swear there is not!  Or, perhaps the serializejson was somehow adding it.  That is the nearest thing I can figure.  Also, interestingly, the database does not find a row, which is false.  There IS a row.  That is where it would be nice if I could cfabort in the script and show something, but it does not show a thing.

     

    In the network tab, it shows the 200 return code, no javascript errors, but the response is that "<".

     

    I appreciate you thinking about this for me.  I am at the end of my rope 🙂

     

    Jim