dtbiszu7724 2016-09-14 23:07
浏览 50

Ajax调用PHP从Javascript迁移到Node.js和Express

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).

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作