1

We have a website front end that is written in ReactJS and the backend is being developed in PHP.

Is it possible to call these functions from within ReactJS?

KPM
  • 181
  • 4
  • 23

1 Answers1

3

You can't directly call a PHP method from ReactJS as PHP is a server-side language and ReactJS is a Javascript framework which means it's client-side language.

What you need to do is to send an AJAX request using ReactJS to your server and use the response.

Take a look at this link: https://facebook.github.io/react/tips/initial-ajax.html

The link describes how to load initial data from server using AJAX.

kfirba
  • 5,231
  • 14
  • 41
  • 70