How can i insert PHP script to JS? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 19

How can i insert PHP script to JS?

PHP no need external link right?, but is it possible to insert PHP to JS?, 'cause I think PHP is much easier than JS, and have a little different.

1st Jan 2018, 3:57 AM
M Yusril
M Yusril - avatar
3 Answers
+ 7
No, JavaScript is run on client browsers, it cannot call PHP script directly which is run from a web server.
1st Jan 2018, 6:01 AM
Calviղ
Calviղ - avatar
+ 2
javascript run on client browser and it call PHP script which run from a web server.
6th Jan 2018, 5:59 AM
Fazli Elahi
Fazli Elahi - avatar
+ 2
the easiest way to access PHP from JavaScript is to use the ajax method. which stands for asynchronies JavaScript and xml. it is useful for transferring data and executing other programming files.
7th Jan 2018, 2:27 AM
Andrew Jester
Andrew Jester - avatar