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 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
    • ¥15 错误 LNK2001 无法解析的外部符号
    • ¥50 安装pyaudiokits失败
    • ¥15 计组这些题应该咋做呀
    • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
    • ¥15 让node服务器有自动加载文件的功能
    • ¥15 jmeter脚本回放有的是对的有的是错的
    • ¥15 r语言蛋白组学相关问题
    • ¥15 Python时间序列如何拟合疏系数模型
    • ¥15 求学软件的前人们指明方向🥺