473,383 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Javascript or PHP ?

296 100+
Hello,

In web development should we do more processing on client side (javascript) or server side (PHP) ?
May 29 '08 #1
15 1380
Tarantulus
114 100+
that entirely depends on what you aim to do.

after all you wouldn't use a screwdriver to bang in a nail, when you have a hammer in arms reach!

what I mean is, PHP and javascript are quite different beasts, as a rule of thumb, aesthetic code (DHTML etc) is handled by JS everything else is PHP IMHO
May 29 '08 #2
hsriat
1,654 Expert 1GB
Hello,

In web development should we do more processing on client side (javascript) or server side (PHP) ?
That depends upon what processing it is.

If your page has to find product of two numbers, then do that in JavaScript. PHP would give slow response in that case.

If your page adds or fetches some data to the database, use PHP. JavaScript alone won't do anything.
May 29 '08 #3
Markus
6,050 Expert 4TB
Hello,

In web development should we do more processing on client side (javascript) or server side (PHP) ?
Using just one or the other isn't possible.

Use must learn to utilise both these languages.
May 29 '08 #4
TheServant
1,168 Expert 1GB
A PHP programmer will have mostly server side, with some client side. A javascript programmer will do the opposite. You ultimately will need to know both, but almost certainly more of one than the other. Most of us here use PHP more, but other people will use Javascript more. My advice, choose one and jump into it and you will see if you like it. Regardless of if you do, learn a bit of the other so you know what the alternative is. But start with one (your choice).
May 30 '08 #5
pankajit09
296 100+
In case of Ajax what should be the choice ?
May 30 '08 #6
coolsti
310 100+
I started out learning PHP and making my application basically without Javascript, but as I learned Javascript more and more, and found I needed more and more client side dynamics, I have incorporated it more and more. Now Javascript is an essential part of my work.

I am the only one working on my application projects, which is a very exciting adventure, because I do both the front and back end programming. Coordinations (like setting up meetings with myself) is a piece of cake, and the programmer on both front and back ends (me) knows exactly what the other wants ;) But because of this I have had the pleasure of learning both PHP and Javascript (and much more).

But I have not yet taken the plunge to using Ajax. I am using what I suppose came before Ajax was developed, by putting a hidden iframe in the page and using Javascript in the main page and iframe to do whatever background work I need without refreshing the main page, and changing elements in the main page dynamically as needed. I believe Ajax lets you do this a bit more elegantly, but my way works for me.
May 30 '08 #7
pankajit09
296 100+
...........
But I have not yet taken the plunge to using Ajax. I am using what I suppose came before Ajax was developed, by putting a hidden iframe in the page and using Javascript in the main page and iframe to do whatever background work I need without refreshing the main page, and changing elements in the main page dynamically as needed. I believe Ajax lets you do this a bit more elegantly, but my way works for me.
Thats fine but I still didn't get the answer.
May 30 '08 #8
perhapscwk
123 100+
Thats fine but I still didn't get the answer.
What i think is of course client side javascript is faster, so if the case that
we can use client side javascript, then use it, always client side javascript first
so it can make your site run faster.
May 30 '08 #9
vijay
30
Hello,

In web development should we do more processing on client side (javascript) or server side (PHP) ?
It depends on the framework u use

if u use struts the validation can be done mostly on server side
by using the struts validaion

So if we have nay validation techniques its beter to use the serverside
May 30 '08 #10
Markus
6,050 Expert 4TB
Ajax is JS and PHP combined.
May 30 '08 #11
coolsti
310 100+
I guess I didn't give you really an answer to your question. To use PHP or Javascript depends on what you are needing to do with/on the particular page.

I use Javascript when I want some decision to be performed on the client side without needing to first contact the server where the PHP is running. This could be to do many tasks, here are some examples:

1) Determine which button that the user pressed, telling the server PHP scripts what to do next (I do not use multiple forms on my pages, just one form and I use Javascript to tell the server where to go next).

2) Submit an iframe to perform a background query without doing a complete new page request (Ajax stuff). This may be because I just wish to update some fields based on user selection, or to avoid rebuilding a page which is time consuming to produce or download.

3) Open up auxiliary windows to show stuff (popup windows).

4) Provide dynamics on the page according to user interactions.

All of the above cannot be done on the server side, at least not efficiently, and so are done on the client side using Javascript.

For user input validations, I do this sometimes on the client side with Javascript, but mostly on the server side after the page was submitted using PHP.
May 30 '08 #12
BigDaddyLH
1,216 Expert 1GB
Ajax is JS and PHP combined.
The AJAX (=asynchronous JavaScript and XML) technique is server-side agnostic. It could just as well be running Java on the server.
May 30 '08 #13
BigDaddyLH
1,216 Expert 1GB
For user input validations, I do this sometimes on the client side with Javascript, but mostly on the server side after the page was submitted using PHP.
Unless you completely trust your clients (hi, grandma!) you must validate input on the server-side even if you're already doing client-side validation (for good validation response).
May 30 '08 #14
Atli
5,058 Expert 4TB
I tend to avoid Javascript as much as I can. Mostly because Javascript is run on the clients browser, and can therefore be turned of or mutilated in other ways.

With PHP I know it will never be bypassed or executed incorrectly by the browser. It is simply more reliable that way.

Comparing AJAX and PHP is completely useless. They are nothing alike... It's like comparing a car to a spaceship... just doesn't make sense.
May 30 '08 #15
Markus
6,050 Expert 4TB
The AJAX (=asynchronous JavaScript and XML) technique is server-side agnostic. It could just as well be running Java on the server.
My apologies - I was considering what the OP had spoken of: PHP and Js.
May 30 '08 #16

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.