+ 104
How to choose between javascript and php to add interactivity to a website?
Help me please!
146 ответов
+ 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
+ 29
It depends on the kind of interactivity you want to add.
+ 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?
+ 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.
+ 17
JS is more standard dynamic language
Better use it. Now it is more relevant, and therefore more demanding and universal
+ 17
my friend.. u have to learn both ....they will help u in the path lf front end development
+ 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 ;-)
+ 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
+ 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!
+ 9
It Depends on what you want to make if you want a web page use JS and for server hosting use PHP
+ 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.
+ 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
+ 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.
+ 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.
+ 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.
+ 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.
+ 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
+ 7
If you need to pass information to server use php along with javascript. Else go for javascript. This comes from my personal experience.
+ 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 ,👍
+ 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).