2. IWT Syllabus:
Module 3:
XML
Introduction to XML, XML vs HTML, Structures of a XML Document, Document Type Declaration (DTD),
XML Validation, Well Formed XML Documents, Valid XML Document, XML DOM, XSL, XSL ransformation,
XML Namespaces, XML Schema.
AJAX
AJAX Introduction, AJAX - The XMLHttpRequest Object, AJAX - Server Response, Ajax XML,
Ajax Database
jQuery
jQuery DOM Selectors, HTML Content, jQuery CSS Styles, jQuery HTML DOM
JSON
Introduction, syntax, Data Types, Parsing, Stringify, Object, Arrays
React.js
Introduction, ES6, Render HTML, JSX, Components , props, state, Lifecycle, Events, forms,
CSS
3. jQuery:
jQuery is a small and lightweight JavaScript library.
jQuery is cross-platform.
jQuery means "write less do more".
jQuery simplifies AJAX call and DOM manipulation.
8. JSON:
JSON: JavaScript Object Notation.
JSON is a syntax for storing and exchanging data.
JSON is text, written with JavaScript object notation.
JSON is a lightweight data-interchange format
JSON is "self-describing" and easy to understand
10. JSON vs XML:
{"employees":[
{ "firstName":"John", "lastName":"Doe" },
{ "firstName":"Anna", "lastName":"Smith" },
{ "firstName":"Peter", "lastName":"Jones" }
]}
<employees>
<employee>
<firstName>John</firstName>
<lastName>Doe</lastName>
</employee>
<employee>
<firstName>Anna</firstName>
<lastName>Smith</lastName>
</employee>
<employee>
<firstName>Peter</firstName>
<lastName>Jones</lastName>
</employee>
</employees>
Both JSON and XML are "self describing"
(human readable).
Both JSON and XML are hierarchical (values
within values).
Both JSON and XML can be parsed and used by
lots of programming languages.
Both JSON and XML can be fetched with an
XMLHttpRequest.
JSON doesn't use end tag
JSON is shorter
JSON is quicker to read and
write
JSON can use arrays
JSON vs XML
JSON is Like XML
11. JSON.stringify():
A common use of JSON is to exchange data to/from a web
server.
When sending data to a web server, the data has to be a
string.
Convert a JavaScript object into a string with JSON.stringify()
<!DOCTYPE html>
<html>
<body>
<h2>Create JSON string from a JavaScript object.</h2>
<p id="demo"></p>
<script>
var obj = { name: "John", age: 30, city: "New York" };
var myJSON = JSON.stringify(obj);
document.getElementById("demo").innerHTML = myJSON;
</script>
</body>
</html>
12. JSON Array:
<!DOCTYPE html>
<html>
<body>
<p>Looping through an array using a for in loop:</p>
<p id="demo"></p>
<script>
var myObj, i, x = "";
myObj = {
"name":"John",
"age":30,
"cars":[ "Ford", "BMW", "Fiat" ]
};
for (i in myObj.cars) {
x += myObj.cars[i] + "<br>";
}
document.getElementById("demo").innerHTML = x;
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<p>Access an array value of a JSON object.</p>
<p id="demo"></p>
<script>
var myObj, x;
myObj = {
"name":"John",
"age":30,
"cars":[ "Ford", "BMW", "Fiat" ]
};
x = myObj.cars[0];
document.getElementById("demo").innerHTML = x;
</script>
</body>
</html>
13. Model Questions:
1. How do you round the number 7.25, to the nearest
integer?
(a) Math.round(7.25) (b) Math.rnd(7.25)
(c) Math.rnd(7.25) (d) round(7.25)
2. How do you find the number with the highest value of
x and y?
(a) top(x, y) (b) ceil(x, y)
(c) Math.ceil(x, y) (d) Math.max(x, y)
14. Model Questions: (Cont.)
3. Is JavaScript case-sensitive?
(a) True
(b) False
4. Which symbol is used in the beginning of jQuery code ?
(a) ? (b) @
(c) $ (d) *
5. The correct syntax for a conditional statement to execute following
code if “x” is NOT equal to 8?
(a) if x =! 8 then (b) if (x<> 8)
(c) if x<>8 then (d) if (x != 8)