[Phpwm] PHP or JavaScript

David Goodwin david at codepoets.co.uk
Tue Feb 23 15:17:31 UTC 2010


On 23/02/10 15:12, Mo Awkati wrote:
> Hi All
>
> /* This is not intended to fuel a heated debate about which is better! */
>
> I just need to be clear in my mind as to which is appropriate to use and
> when. I recognise that one is server side and the other is browser side.
> I see both as tools in a toolbox and therefore use as appropriate.
>
> The way I see them: JavaScript for presenting web pages, PHP for data
> handling and processing.
>
> Am I on the right tracks? I would welcome your thoughts on this, if you
> can give me an example/s where one is more appropriate to employ than
> the other, or indeed where they both live happily together! Obviously
> there are areas where they overlap.
>


It should be the case that Javascript merely enhances the user 
experience - e.g. adding a popup calendar, rather than someone having to 
type in 2010/01/21 or provides e.g client side validation (i..e no need 
to click submit and wait for the server to respond).

In an ideal world, PHP does everything (validation, data presenting etc) 
and then Javascript perhaps makes the page more interactive - but if JS 
is turned off everything continues to be usable.

David.

-- 
David Goodwin

[ david at codepoets dot co dot uk ]
[ http://www.codepoets.co.uk       ]



More information about the Phpwm mailing list