Highlighted

Finding JSON errors in .cfc

Community Beginner ,
May 30, 2019

Copy link to clipboard

Copied

I am rendering a screen using AJAX / and a cfc. (No reloads)

All goes well until I make a boo boo and get a JSON error.

I know what causes it - text that should not be in the cfc. 

But now I've hit a brick wall.  I cannot find the "extra text" that's causing it.

Or ... is that the only cause?

The odd thing is the application runs fine on the bets server but not on localhost.

So I looked for any / all instances of "localhost" or 127.0.0.1 and nothing problematic.

Is there a tool out here that scans cfc's for these silly errors?

I have looked in the server admin logs but I have no idea which of the log files would house it.

Usually only use application.log

Thanks

TOPICS
Advanced techniques

Views

271

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Finding JSON errors in .cfc

Community Beginner ,
May 30, 2019

Copy link to clipboard

Copied

I am rendering a screen using AJAX / and a cfc. (No reloads)

All goes well until I make a boo boo and get a JSON error.

I know what causes it - text that should not be in the cfc. 

But now I've hit a brick wall.  I cannot find the "extra text" that's causing it.

Or ... is that the only cause?

The odd thing is the application runs fine on the bets server but not on localhost.

So I looked for any / all instances of "localhost" or 127.0.0.1 and nothing problematic.

Is there a tool out here that scans cfc's for these silly errors?

I have looked in the server admin logs but I have no idea which of the log files would house it.

Usually only use application.log

Thanks

TOPICS
Advanced techniques

Views

272

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
May 30, 2019 0
Adobe Community Professional ,
Jun 01, 2019

Copy link to clipboard

Copied

What is the error? Could you share the CFC code?

How many ColdFusion instances do you have? You should look in the logs of the instance that runs the CFC.

The best tool for detecting errors is ColdFusion itself! As your code is running as intended, the problem is possibly caused by Javascript.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 01, 2019 0
Community Beginner ,
Jun 01, 2019

Copy link to clipboard

Copied

Thanks for your reply. 

As the only interaction with JS is calling the function, then using a xxx.innerHTML=value  the problem must be within the cfc

Sharing the cfc would overload this message!

Only one instance on this server.  Only difference between server and localhost is WIndows server and WIndows 7.

cfajax.js:872 Uncaught SyntaxError: parseJSON

    at Object.decode (cfajax.js:872)

    at Object.$X.processResponse (cfajax.js:554)

    at Object.$X.invokeInternal (cfajax.js:511)

    at Object.$X.invoke (cfajax.js:458)

    at ns.<computed>._cf_realty.propertyDetail ((index):189)

    at showProperty (js_public.js:1615)

    at HTMLInputElement.onclick ((index):1)

is the error. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 01, 2019 0
Adobe Community Professional ,
Jun 01, 2019

Copy link to clipboard

Copied

What you show is in fact a Javascript error. Are you calling the CFC using the cfajaxproxy tag? That would then make sense, as cfajaxproxy creates a JavaScript proxy for the CFC.

If so, it would help if you could share the code for the CFC and for cfajaxproxy. You could send the code by private-message.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 01, 2019 0
Community Beginner ,
Jun 01, 2019

Copy link to clipboard

Copied

I fixed it already by merely commenting out a bunch of the cf component lines.

I also PM'd you.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 01, 2019 0