Scripting is sometimes called a program that means some code that runs on computer to perform any task. Now there are two types of scripting, one is called client side scripting and other is called server side scripting. Let me discuss both of these.
Client side scripting
Client side scripting is that script which runs on user browser like Firefox or Google Chrome. Client side scripting consumes user computer resources like graphics card if any animation is done by the script. The client side script is interpreted by the browser.
Uses of client side scripting
Client side scripting is used when user is filling some form on web page and it is used for form validation. For example if the user not fills some fields like its phone number then script will prompt it to enter his phone number. Similarly validation of email is done by the client side script to check whether it is valid email id or not.
Why to use client side scripting
Client side scripting is fast. Some people think that client side scripting is more secure than server side scripting. Form validation is done quickly using client side scripting. Different animations can be drawn by the script and also different functions like displaying system clock and date picker is done easily with client side scripting.
Example of client side scripting language
Here are few example of client side scripting languages:-
Server side scripting
Server side scripting is that which runs on server side also called web servers. The web servers are those which are provided by hosting companies like you get hosting from different web hosting companies. The web server understands server side languages.
Uses of server side scripting
We use server side scripting to get data from the database. When the user type the url in browser then a request is send to the web server, then web server find the specific page and transfers to browser, then browser translates that web page and displays it to the user. In simple words server side scripting is not done on browser or on user computer. Server side scripting is fully controlled by the web server and it not depends upon which browser the user is using. Server side scripting is sometimes slow because if the user disconnects from the internet or the web hosting is down then the script may take long time to execute. Complex computation is done by the server side scripting that client side scripting cannot perform easily. A technology called ajax which use server side scripting. Ajax displays new data on the website without reloading the page. Similarly if we want to check that a specific email id is held by any other user then this is also done with ajax using server side language.
Why to use server side scripting
In nowadays there is problem that different people are using different browsers so client side scripting is sometimes blocked by some browsers. And user can also block client side scripting to execute. Server side scripting is not dependent upon browser processing, all the processing is done on server side i.e. web server. Sometimes server side scripting is unsecure because it is used to hack a website. Server side scripting is used to make big websites like bank websites and it involves server side validation. Good websites uses both client side validation and server side validation to secure their websites. Web developers have expertise of both client side scripting language and server side scripting languages.
Examples of server side scripting
Here are few server side languages:-