0

I have a working PHP based API that sends JSON-Data for Ajax requests.

I wonder if there is any way to call those PHP Files from NodeJS, maybe even by an Ajax Request, so i don't have to rewrite all my Code.

The PHP Server will alwasy be running, because the "normal" Page is based on it. But loading and saving should be managed by the NodeJS Server.

1
  • 3
    Yes, it's possible to hit a URL address with your NodeJS Server. Commented Feb 14, 2015 at 18:36

1 Answer 1

2

You may use node.js request library for this - Examples are provided in - https://github.com/request/request

Your client side ajax code should direct to node.js application server and then from node.js server, you can send request through the above and on callback of the code,you will have the result, which you can return as response to your ajax callback...

Hope this will help you.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.