HTML, Javascript and Ajax By wanleung (20th Feb, 2021)
Web Technology - BackEnd - FrontEnd
Backend - Web servers - HTML Pages, Data, etc from the web server. - HTTP protocol (GET, POST) - Web services, CGI, SOAP, API, Restful API…. - Php, Perl, Javascript (nodejs), Python, Java, Ruby, Go, Rust, C# …...
Frontend - Web Browser - HTML, CSS, Javascript, XML, json - Ajax. - (old) jQuery, Prototype…. - (latest) ReactJS, AnglurJS, Vue.
HTML HyperText Markup Language Sir Timothy John Berners-Lee (TimBL) 1993 1st release. Concept in 1989, inspire from SGML (Standard Generalized Markup Language, 1986) and IBM GML from 60s.
HTML HTML Tags <html> <head><title>Testing</title></head> <body></body> <h1>Hello</h1> <p>I am 1st line. <br /> I am 2nd line</p> </html>
HTML <span></span> - is an inline container used to mark up a part of a text, or a part of a document. <div></div> - defines a division or a section in an HTML document.
HTML
HTML5 Canvas Drag and Drop Media support WebRTC WebStoarge etc...
XML Extensible Markup Language 1996. Inspire from the simplicity of HTML. For Data. Human readable.
XML <tag></tag> <tag attr=”value”></tag> <emptyline />
XML <name> <firstname>Bob</firstname> <lastname>Foo</lastname> </name> <name> <firstname>Chris</firstname> <lastname>Bar</lastname> </name>
DOM Document Object Model Data Structure - Tree
DOM
CSS Cascading Style Sheet In a much easier way to control web layout and style such as colour, margin, padding, font type and side.
CSS
CSS
CSS
CSS . = class # = id
CSS Frameworks: - Bootstrap - Foundation
Javascript Javascript is a scripting language run on browsers. developed by Netscape 1995. Javascript is not Java. Microsoft reverse engineering on Netscape and developed JSscript and CSS on IE in 1996. As the browser war, Javascript and JSscript although the syntax are almost the same, they are not fully compatible between different browsers.
Javascript Netscape fight back: Standardization Submitted Javascript to ECMA International in 1996, becoming ECMAScript 1.0 in 1997. ECMAScript 2.0 in 1998, ECMAScript 3.0 in 1999, ECMAScript 4.0 in 2000. But as IE had a market share 95% in 2000s, JSscript was the de facto standard, and not very helpful on the working of standardization. It was the nightmare at the time. During the time Microsoft was pushing its VBscript. Adobe was pushing its Actionscript.
Javascript Turning Point: 2005 Jesse James Garrett release a white paper on the concept of AJAX. Asynchronous Javascript and XML Using the benefit of ECMAScript4 (ES4), XML and other technology on browser, such as DOM, to handling the GET / POST call and data processing at the background. So, user will no longer recognize the page refreshing whole page when updating data.
Javascript A lot of opensource communities supporting the new technology AJAX. jQuery, Prototype, Dojo. Firefox and Webkit (Safari) Google was working on the new browser Chromium release the V8 Javascript engine in 2008.
Javascript Finally, all the parties had a conference in Oslo 2008. This led to the eventual agreement in early 2009 to combine all relevant work and drive the language forward. The result was the ECMAScript 5 standard, released in December 2009, which we also called it as ES5. ECMAScript 6 (ES6) in 2015.
Javascript But at the moment, it is still not every browsers implement to support HTML5, CSS3 and ES6. There are still a very little part that the output is not the same in every browsers with the same code. But it is far better before 2008 and becoming better.
AJAX Asynchronous JavaScript and XML - is a set of web development techniques using many web technologies on the client-side to create asynchronous web applications. With Ajax, web applications can send and retrieve data from a server asynchronously (in the background) without interfering with the display and behaviour of the existing page.
AJAX Using Javascript to handle the DOM tree. And use XML as the format of the data transmission via HTTP protocol.
AJAX
DOM
XML Problem: Network traffic need cost. <tag></tag> format wastes too much traffic Slim down data traffic solution: JSON
JSON JavaScript Object Notation
JSON
JSON
JSON
JSON
JSON
JSON
XML <name> <firstname>Bob</firstname> <lastname>Foo</lastname> </name> <name> <firstname>Chris</firstname> <lastname>Bar</lastname> </name>
JSON { “name” : [ {“firstname”: “Bob”, “lastname”: “Foo”}, {“firstname” : “Chris”, “lastname”: “Bar”} ] }
Coding First. Download VSCode
Coding After install:
Coding Click to open the extension tab
Coding Search “Live Server”, “Browser Preview” and “open in browser” and install
Download http://office.ben7.net/javascript-test.zip
Editing HTML Right click the editor, and then choose “open with live server”
AJAX JSON TEST URL http://office.ben7.net/1823_statistic.json

HTML, Javascript and AJAX