I'm having a strange situation and I'm not quite sure where to start looking. I have a knockout.js form on the front end, and CakePHP in the backend.
As of right now, I send some JSON data from a knockout.js form to CakePHP. This PHP does some processing and then echo's the result in JSON format back to the knockout javascript file.
Well, the issue is when I have this PHP setup through CakePHP it seems to only work maybe 1/4 of the time. When I have this PHP file in my webroot (just a standard file, not associated with Cake, because knockout is backend agnostic after all) it works 100% of the time.
So here are the two data flows
Fails frequently: knockout.html -> knockout.js -> CakePHP Controller -> echo in CakePHP view-> knockout.js -> knockout.html
Works 100%: knockout.html -> knockout.js -> PHP in webroot, echo from the same page -> knockout.js -> knockout.html
I would just use the PHP file in my webroot but I have to query the database for a few things and I'd like to keep all the querying up to Cake and not outside sources.
Is the CakePHP method possibly taking too long and failing because it's not getting a result back quickly enough?
edit- I changed my controller so there are no calculations, it simply passes on some JSON encoded text to the view. This produces no errors and has worked 100% of the time. So, is it safe to say that CakePHP is taking too long causing the error? I understand a framework takes longer than just plain PHP, but why would this cause it to fail? I'm not doing any intense calculations.