Unit 3 Imp Web Technology
Unit 3 Imp Web Technology
Q1. What is AJAX ? Explain its advantage and its working.Explain with example.
Ans:
AJAX:
This means that parts of a web page can be updated without having to reload the entire
page.
Example of AJAX:
<!DOCTYPE html>
<html>
<body>
<div id=“demo”>
button>
</div>
<script>
function loadDoc() {
xhttp.onreadystatechange = function() {
d o c u m e n t . g e tE l e m e n tB y Id (“ d e m o ”) . i n n e r H T M L =
this.responseText;
};
xhttp.send();
</script>
</body>
</html>
Output:
Q2.
Design a JavaScript program to display the current day and time in the
following format.
Today is : Monday.
Current time is : 11 AM : 50 : 58
Ans:
<!DOCTYPE html>
<html>
<head>
<style>
body {
margin: 50px;
.time-container {
font-size: 20px;
</style>
</head>
<body>
<div class="time-container">
<p id="day"></p>
<p id="time"></p>
</div>
<script>
function displayDateTime() {
var timeString = "Current time is : " + hours + " " + ampm + " : " + minutes + " : "
+ seconds;
document.getElementById('day').textContent = dayString;
document.getElementById('time').textContent = timeString;
displayDateTime();
</script>
</body>
</html>
Output:
Today is : Tuesday.
Ans:
Types of Sockets:
Chat applications
TCP/IP Server refers to a server that uses the TCP/IP protocol suite to
communicate over a network.
IP (Internet Protocol):
Responsible for addressing and routing packets of data so that they can travel
across networks and arrive at the correct destination.
Key Characteristics:
Reliability:
TCP ensures that data sent from a source to a destination is delivered accurately
and in the same order it was sent.
Connection-Oriented:
A TCP server establishes a connection with the client before data transfer begins,
ensuring a secure and reliable communication channel.