-3

I am just learning php. My approach to learning is that I start analysing the code in a language I am more familiar with.

Hence, I am trying to replicate a PHP dashboard with PHP features like role management, session logging etc.

As I am halfway through it, I find that using ajax , though not primarily meant for it, I can talk to a server.

Using Http verbs, I can also make modifications.

Hence, can JavaScript and Ajax together act as a server side scripting language on its own?

My understanding is a server side scripting language just interacts with the server. As ajax does the same using JavaScript and http verbs . Can it essentially replace PHP?

I did a little research, and found server side scripting languages have their own pros like filtering, jQuery and Ajax can use less bandwidth etc.

But everything seems vauge.

Hoping to get a better understanding.

Thank you:)

  • 2
    If you want JavaScript that runs on client and server, check out https://nodejs.org/en/ and (https://reactjs.org/ or https://vuejs.org/). – Adrian J. Moreno Jan 08 '19 at 21:25
  • 1
    The distinction between server-side and client-side is there for a reason. PHP works on the server and provides responses to ajax requests. . – Eriks Klotins Jan 08 '19 at 21:25
  • Thank you guys, looks like I have got the fundamentals wrong!!:`(. Seeing the project I had, which is using PHP for making client side logical decisions, and making cURL requests only. I assumed that's all It did. Still, thank you for the responses:) – Abhilash Gopalakrishna Jan 08 '19 at 21:35

1 Answers1

2

Server side scripts run at the server, not at the "client" (browser). Javascript run at the browser. Ajax is a feature of JS that allow you to interact with a server without doing a full POST back to that server (changing the page you are actually seeing). During an AJAX call you can interact with whatever is on the server side (PHP, .NET, etc) There are even some sites that have multiple server side scripts.

enter image description here

Merak Marey
  • 630
  • 4
  • 15