You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// asynchronous মানে হচ্ছে একাধিক কাজ একই সময়ে চলা। আমরা যখন function কল করি তখন ওই function execute করার পর এর পরের লাইন বা function execute হয়। কিন্তু এখানে অন্য কোনো function যদি রান করতে টাইম বেশি লাগে এটির কাজও চলতে থাকে সাথে এর পরের কাজ বা অন্য প্রোগ্রামগুলাও চলতে থাকে।
3
+
4
+
//We use JSON heere Instead pf XML
5
+
// AJAX is a developer's dream, because you can:
6
+
// Read data from a web server - after the page has loaded
7
+
// Update a web page without reloading the page
8
+
// Send data to a web server - in the backgroun
9
+
// AJAX is not a programming language.
10
+
// AJAX is a technique for accessing web servers from a web page.
11
+
// AJAX stands for Asynchronous JavaScript And XML.
// It creates a new instance of XMLHttpRequest named xhr, which is the core of AJAX requests.
21
+
22
+
letxhr=newXMLHttpRequest();
23
+
24
+
//Open the file
25
+
// ** Purpose: This open() method configures the request.
26
+
// * The first argument ('GET') specifies the type of HTTP request (GET request in this case, used to retrieve data).
27
+
// * The second argument ('data.txt') is the file to be requested from the server.
28
+
// * The third argument (true) sets the request to be asynchronous, meaning the JavaScript will continue to execute without waiting for the server's response.
29
+
xhr.open('GET','data.txt',true);
30
+
xhr.onprogress=function(){
31
+
console.log(this.readyState);
32
+
}
33
+
34
+
// call onload function function for load data
35
+
// Purpose: This defines the onload event handler, which is triggered when the request is complete.
// Purpose: This sends the actual request to the server to retrieve the data.txt file.
51
+
xhr.send();
52
+
}
53
+
54
+
// How It Works:
55
+
// 1. When the user clicks the button with ID get-data, the loadData() function is called.
56
+
// 2. An AJAX request is made using the XMLHttpRequest object to fetch the contents of data.txt.
57
+
// 3. When the response is received (if the status is 200), the contents of the file are inserted into the webpage inside the element with the ID showData.
58
+
// 4. If there are errors (e.g., 404 Not Found), nothing is displayed, but you could add additional handling for other statuses.
59
+
// This is a basic example of how AJAX can be used to dynamically load data from the server without needing to refresh the page.
60
+
61
+
62
+
63
+
64
+
//Methods 2(Previous Used) onreadystatechange
65
+
66
+
// function loadData(){
67
+
// let xhr = new XMLHttpRequest();
68
+
// xhr.open('GET','data.txt', true);
69
+
70
+
71
+
// //oneprogress method used data is comeing to progress
72
+
// // we show something on onprogress "Data in progress please wait"
// অ্যাপ্লিকেশন প্রোগ্রামিং ইন্টারফেস বা এপিআই হচ্ছে এক গুচ্ছ ফাংশনের সমষ্টি। এটি একটি ইন্টারফেস যা কোন কম্পিউটার, লাইব্রেরি অথবা অ্যাপলিকেশন অন্য অ্যাপ্লিকেশনকে বিভিন্ন সার্ভিস দেয়ার লক্ষ্যে বা ডাটা বিনিময়ের জন্য প্রদান করে থাকে। সাধারণত সফটওয়্যার প্রস্তুতকারক কোম্পানি এটি তৈরি করে। অন্য কোনো প্রোগ্রাম ঐ সফটওয়্যারকে নিজেদের সাথে একীভূত করতে চাইলে এপিআই এর মাধ্যমে সফটওয়্যারের সাথে যোগাযোগ রক্ষা করে।[১]
115
+
116
+
// What is RESTful API?
117
+
// RESTful API is an interface that two computer systems use to exchange information securely over the internet. Most business applications have to communicate with other internal and third-party applications to perform various tasks. For example, to generate monthly payslips, your internal accounts system has to share data with your customer's banking system to automate invoicing and communicate with an internal timesheet application. RESTful APIs support this information exchange because they follow secure, reliable, and efficient software communication standards.
118
+
119
+
// What is REST?
120
+
// Representational State Transfer (REST) is a software architecture that imposes conditions on how an API should work. REST was initially created as a guideline to manage communication on a complex network like the internet. You can use REST-based architecture to support high-performing and reliable communication at scale. You can easily implement and modify it, bringing visibility and cross-platform portability to any API system.
121
+
122
+
// API developers can design APIs using several different architectures. APIs that follow the REST architectural style are called REST APIs. Web services that implement REST architecture are called RESTful web services. The term RESTful API generally refers to RESTful web APIs. However, you can use the terms REST API and RESTful API interchangeably.
123
+
124
+
// The following are some of the principles of the REST architectural style:
0 commit comments