novice web developer here.
Right now I have an app that takes information from a page presented to the user, and does an ajax call with this information to some PHP code that runs an algorithm and returns an answer.
The front end code is written in vanilla html, and Javascript (with jQuery) for the ajax call. Everything is sitting on the same machine.
Now I'd like to change the design: I want to keep all the PHP code exactly the same on my machine, but I'd like to migrate the front end code from vanilla html/javascript to Parse.com's "Cloud Code", which is apparently a Node.js framework called Express. So the physical locations of the code will also change: the PHP algorithms will sit on my machine, but what is being served to the user now sits on Parse.com.
I can't make the same ajax calls from jQuery in the Cloud Code because I assume I would run into the same origin policy. I also don't really want to make the calls from Javascript because I no longer want this information to be available to view on the browser: I want to take data straight from the Parse database, pass it to my PHP code, then have it return an answer so that I can display that to a user. All the way up to displaying an answer to the user, I want this data hidden from the user so he doesn't know what is being grabbed from the Parse DB, or what data is being passed to my server.
At the risk of sounding ignorant, what do I have to do to get the server side Express code to talk to a remote PHP library, send data to it and receive an answer, then display that to the user in a completely ajax manner? Is it even possible?
Before suggesting, I can't get rid of the PHP bit, because it wraps around a heavy-duty image processing library called Imagemagick (Imagick is the PHP extension).