Tuesday 13 May 2014

JavaScript and jQuery Fundamentals Client Side and Server Side

Introduction
It is not a full programming language however it can be used to design simple task such as designing interactive menus. Scripting languages can be used to help increase interactivity of the webpages. In this blog I will be stating fundamentals of JavaScript and jQuery as well as explaning client and server side.  

JavaScript
JavaScript is a scripting language that enables web creators to design interactive sites. JavaScript is an open language meaning it can be used by anyone without having to buy a license. One of the tasks that JavaScript is able to do is that it can interact with the HTML code of a website which allows website creators to put in dynamic content in their sites. All browsers today support JavaScript as it is a crucial part of our everyday browsing experience. We may not notice it but it’s on nearly every website; from e-commerce websites such as Amazon and e-bay to watching videos on YouTube. For example with JavaScript you can add animations to a website to attract customers and if the user clicked on the animation it could take them to a certain page on the website. In conclusion, JavaScript allows people to build highly responsive user interfaces, prevent frustrating page reloads and even fix issues for CSS. These types of languages, which can enable functionality to work, are client side scripting languages, which affect the data that the end user sees in a browser.
One of the benefits of JavaScript is that most browsers support scripting language, therefore users can use it on many different browsers. however if a browser does not support it, then browsers detection informs the user the page they are trying to view is not supported by this browser; therefore redirecting the users.

jQuery
jQuery is not a language, but instead is well written JavaScript code. jQuery almost simplifies basic tasks that you would want to happen in a web browser; it is a library of JavaScript code. It is very useful because the simple things such as making a pop-up box appear in a website when a button is pressed could be written in as little as 2/3 lines of jQuery whilst in JavaScript it would take a whole page of coding. This is because it is its own library where it stores all the information related to jQuery so that you do not need to define each and every single aspect. jQuery helps to implement user interface related functionality without having to write hundreds of lines of codes, in other words; it’s simple, clean and fast.

Client side
Client side scripting is executed on the clients’ web browser, it is embedded into HTML and with the help of CSS and JavaScript; WebPages can be more graphical. Buttons, splash screens and dropdown lists can be created with ease. Client side scripting is mostly used for design work, such as creating graphical interfaces and effects. Client side scripting provides a quicker response than server side scripting as the users action does not have to travel to the server and back.      

 

One of the advantages client side servers is that it is executed on the user's computer and therefore responds immediately to users actions, and executes actions quickly as well. It also allows the developers to have more control over the creation of web pages, for example the look and usability of the webpage. However not all browsers support the scripts and those who do support, support it differently. Therefore the look of the webpage may be different in every browser. One advantage of server side scripting is that since it does not require plug ins, it reduces the load on the user’s computer. However it requires the language to be installed on the server.

For example on the Amazon website when the users hover over a button on the navigation bar, a drop down list appears. This is done by client side scripting. If this action was to be done by server side scripting then a lot of time would be needed because the data would be transferred from client to server and server to client continuously, which could be extremely time consuming and would require a lot of processing from the server; therefore it executes the action straight from the client’s computer and browser.



Server Side

Server side scripting is a form of scripting language which uses servers to execute actions; it waits for users’ action; once the action has been performed the data travels to the servers’ database and then waits for the servers’ response. Meanwhile the server searches through the database; when the server has found what it’s looking for it will send the information back to the client and the webpage can then be displayed on clients’ web browser.    

Server side scripting is usually used in actions that require security; such as online payments. Since server side is more secure and payments require client’s data to be checked on the server therefore server side scripting is used. Therefore making it more secure than client side scripting.  


User Experince

Client side scripting can be embedded into HTML; and can work with CSS therefore it allows developers to create more graphical and interactive webpages. Client side scripting responses are a lot quicker than server side scripting responses.

Interactivity is very important on a website, for example if a user searches a page on Amazon it can take a really long time to find what they want. However with the buttons and drop down lists and drop down menus, they would find it a lot easier to search through and easier to refine what they are looking for.

Websites use web functionality such as pop-ups and drop down menus, Amazon is a good example as it has drop down menu and if the mouse is hovered over a link it becomes bold and orange telling the user they have performed an action.


Developers can create web pages with HTML; however without any scripting the webpage will not be responsive to users’ actions. By adding client side scripting the developers can create more interactive web pages; this method enables the developers to create events by hiding or showing elements on the page, moving elements, or changing colours and fonts. Showing and hiding tables is the essence of how you create a drop down menu on a Web page.
Validation
Validation is used in client side as well as server side, however both ways are different. Validation is needed in both scripting languages in order to validate data which is entered into the specific fields within a webpage.

Validation means that data is applicable; JavaScript can also be used to validate data before sending it off to the server for example if an email is required, the website would validate if the email is correct. It can do this by looking for the ‘@’ sign; as it would not go through millions of email adds to see if the email address exists. This means that the request is sent to the server to validate if it is an email address. This means that the request is send backwards and forwards wasting time. Therefore if the validation is done on client side using JavaScript, it saves from the request sending forward and backwards.

References:
Website-Wikipedia
Date-06/05/2014
Time- 4:30
http://en.wikipedia.org/wiki/JQuery

Website-programmerstackexchange
Date-06/05/2014
Time- 4:50
http://programmers.stackexchange.com/questions/46137/what-is-the-main-difference-between-scripting-languages-and-programming-language

Website-w3school
Date-04/06/2014
Time- 4:50
http://www.w3schools.com/js/js_form_validation.asp

Website-microscopy
Date-04/06/2014
Time- 10:00
http://www.microscopy-uk.org.uk/