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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 有人会搭建GPT-J-6B框架吗?有偿
    • ¥15 求差集那个函数有问题,有无佬可以解决
    • ¥15 【提问】基于Invest的水源涵养
    • ¥20 微信网友居然可以通过vx号找到我绑的手机号
    • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
    • ¥15 解riccati方程组
    • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
    • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
    • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
    • ¥50 树莓派安卓APK系统签名