+ 104

How to choose between javascript and php to add interactivity to a website?

Help me please!

29th Nov 2017, 12:50 PM
Josué Charles
Josué Charles - avatar
146 Answers
+ 26
if your code needs to be processed by the server, you can use PHP or Javascript on NodeJS. if your code needs to be processed by the client, that is to say, the web browser, you need to use javascript, or jQuery that is a javascript library
1st Dec 2017, 9:11 PM
⏩▶Clau◀⏪
⏩▶Clau◀⏪ - avatar
+ 29
It depends on the kind of interactivity you want to add.
4th Dec 2017, 1:18 PM
Igor Makarsky
Igor Makarsky - avatar
+ 22
Thx @Marcel Feenstra for the difference. But if the data that visitors must submit are not sensitive and we do not need to save them, for a better site management and for a lower cost, language server-side or JavaScript?
29th Nov 2017, 1:13 PM
Josué Charles
Josué Charles - avatar
+ 22
If your visitors are submitting data, then you use PHP to process it, depending on what the data is, e.g they are filling out a form and you want to save that data. If you're just making a game, JavaScript is what you'll need. It's in charge of how you interact with the website. HTML and CSS define the look of your site, whilst JavaScript tells it what to do and how to change itself depending on what the user does. Also, there's no increased cost with PHP, because it's just like CSS and HTML where it is stored inside a small text file, unlike MySQL and other databases where some web hosts may not provide free use of MySQL because they're much larger.
30th Nov 2017, 2:12 AM
reinadf
reinadf - avatar
+ 17
JS is more standard dynamic language Better use it. Now it is more relevant, and therefore more demanding and universal
29th Nov 2017, 1:00 PM
stKhaDgar
stKhaDgar - avatar
+ 17
my friend.. u have to learn both ....they will help u in the path lf front end development
29th Nov 2017, 1:18 PM
Android Boi
Android Boi - avatar
+ 17
Learn both. The key is understanding when to apply the right solution. But from a business point of view and winning clients, JS is used on over 80% of websites globally. PHP is central to WordPress which powers almost 30% of the billion+ sites online and most of those need developer help and have little knowledge on all the functions available. The more database intensive, I'd lean towards PHP. The UX, I'd start with JS. Learning JS will also give you the foundation to a world of libraries like jQuery, NodeJS, Trails.js, and a gazillion others. All of these are hard to understand without the bedrock foundation of JS under your belt. Hope this helps ;-)
30th Nov 2017, 3:31 AM
Scott Groves
Scott Groves - avatar
+ 15
Now there's the term named as 'Full Stack Developer', i.e. developer who knows Frontend (HTML, CSS, JavaScript) and Backend (PHP, Ruby, Node.js etc.), so you can learn all web-based langs
4th Dec 2017, 8:22 PM
Bohdan Sakovych
Bohdan Sakovych - avatar
+ 12
If you want to be a serious web developer, full stack, there is no choosing between PHP and JavaScript, you will need both in a very serious way. So learn both and you will thank your stars for that decision. And I know some people look down upon php as an inferior, almost obsolete language, trust me it's not. Apart from being the language that runs sites like Facebook and WordPress it's robustness in terms of security cannot be overemphasized. I wouldn't choose if I were you!
4th Dec 2017, 5:30 PM
WadeQ
WadeQ - avatar
+ 9
It Depends on what you want to make if you want a web page use JS and for server hosting use PHP
5th Dec 2017, 12:19 PM
warlord
warlord - avatar
+ 8
As you said you want to add interactivity,I think it's useless to explain php's main purpose.Now,the language you gonna use depends on the size of code,or even better,the amount of interactivity.In case you chose php,the codes will he interpreted in server,thus reducing the loading time of interactivity in browsers,but it will increase the data usage,as rendered graphics(for example) is bigger in size than just plain JavaScript.So whether to use php or JavaScript depends on your usage,if you really large graphics,better use JavaScript since it's interpreted on browser rather than server, reducing server's effort.
30th Nov 2017, 6:15 AM
Vikaash
Vikaash - avatar
+ 8
JavaScript is client side programming language which executive on client side who help to increase your program's performance and it is also used with various languages mostly like .net, servelet,html,xml on the other hand php is server side programming which execute on server then transfer respondes to the client's system. which depends on the net speed also. so I strongly prefer to learn JavaScript firstly with no confusion then you can go for php. upvote who agree and if you got your answer
3rd Dec 2017, 4:43 AM
Devendra Kumar
Devendra Kumar - avatar
+ 8
PHP is a programming language. It is often used for server side programming, but has uses in general programming too.JavaScript is a programming language. It is the only language that has a decent level of native support for running in a browser. It has a wide variety of server side implementations (including Node and ASP). It is one of the languages you can use with the Windows Scripting Host. Personally I would prefer Javascript for and interactive website.
4th Dec 2017, 8:12 PM
George Victor Uche
George Victor Uche - avatar
+ 7
If it hasnt been built yet, it will be with JavaScript. But PHP on the other hand is still in use, so learning it wont be a waste of time. But its up to you.
29th Nov 2017, 6:01 PM
Dwain Aiolupotea
Dwain Aiolupotea - avatar
+ 7
Remember that php is processed and the user dont see the code. javascript in the client side can be edited if they want. php can be related to database connections and deciding what the user views. javascript is the user taking actions and changing the page.
2nd Dec 2017, 2:51 PM
Cristian Seoane
Cristian Seoane - avatar
+ 7
I agree with the many that say both are important for an interactive site: php is best for server activities and javascript is best for activity directly in the browser on the client side. But, don't forget that even if you decide PHP is the way to go, you will use php to generate web content generally consisting of html, css, and javascript! So, yeah, both. But if you have to choose only one, then javascript (and html and css) because these are the building blocks of the pages you want to serve.
2nd Dec 2017, 2:57 PM
Rob Blans
Rob Blans - avatar
+ 7
php is a server side scripting language and js is a client side language. Hence js is used for providing interactivity to your web pages
3rd Dec 2017, 3:44 AM
Vishnu DxB
Vishnu DxB - avatar
+ 7
If you need to pass information to server use php along with javascript. Else go for javascript. This comes from my personal experience.
3rd Dec 2017, 5:38 AM
Arunkumar Palanisamy
Arunkumar Palanisamy - avatar
+ 7
I am a beginner in server side technologies, but I know this much that, whatever you are doing with PHP is possible with nodejs( runtime environment for JavaScript) ,in some ways even better coz nodejs is nonblocking (asynchronous) so I learned JavaScript for client side design & animation stuffs, but now I can also do backend stuffs using JavaScript only, isn't that amazing and that's the beauty utilized in MEAN stack ( mongoDB, express, angular, nodejs). so I skipped PHP courses which is comparatively not that tough though, but instead having even better command over JavaScript so that I come close to job requirements ,👍
4th Dec 2017, 3:22 PM
Morpheus
Morpheus - avatar
+ 7
JS is a client-side scripting language, that is it is executed on the user's web- browser , instead of the web server, saving bandwidth, making it faster. JS can be combined with HTML, XML, and AJAX. You can do animations and calculatations with it. JS is very interactive, because it interacts with the user by means of forms, and popup- windows, and input validation. PHP executes on the web-server, and anybody who knows some C programming can pick it up quicker. PHP supports many databases (MySQL, Oracle, and etc).
4th Dec 2017, 8:24 PM
Rick Zalman