JAYBEE D. MARANAN_MODULE 6

 

What is XML ?


ML (Extensible Markup Language) is a markup language similar to HTML, but without predefined tags to use. Instead, you define your own tags designed specifically for your needs. This is a powerful way to store data in a format that can be stored, searched, and shared. Most importantly, since the fundamental format of XML is standardized, if you share or transmit XML across systems or platforms, either locally or over the internet, the recipient can still parse the data due to the standardized XML syntax.




XML VS. HTML: WHAT’S THE DIFFERENCE?

  • XML is a markup language used to store, transport and exchange data. HTML is a markup language used to create web pages.
  • XML focuses on storing data. HTML displays data.
  • XML uses tags to describe the data, but the tags are defined by the user. HTML has predefined tags.



JSON

JSON (JavaScript Object Notation) is a lightweight format for storing and transmitting data. It’s commonly used in web applications for exchanging data between a server and a client. Let me break it down for you:

  1. Human-Readable Format: JSON uses plain text to represent data. It’s easy for both humans and machines to read and write.

  2. Attribute-Value Pairs: JSON data consists of attribute–value pairs. Each attribute (or field) has a corresponding value. For example:

{
    "firstName": "John",
    "lastName": "Doe"
}
Objects and Arrays: JSON objects are enclosed in curly braces {} and can contain multiple attribute-value pairs. Arrays, denoted by square brackets [], can hold multiple objects or values. Here’s an example with an array of employee records:
{
    "employees": [
        {"firstName": "John", "lastName": "Doe"},
        {"firstName": "Anna", "lastName": "Smith"},
        {"firstName": "Peter", "lastName": "Jones"}
    ]
}

Common Uses of JSON

JSON is heavily used to facilitate data transfer in web applications between a client, such as a web browser, and a server. A typical example where such data transfer occurs is when you fill out a web form. The form data is converted from HTML to JavaScript objects to JSON objects and sent to a remote web server for processing. These transactions could be as simple as entering a search engine query to a multi-page job application.

When companies make their data public for other applications, like Spotify sharing its music library or Google sharing its map data, the information is formatted in JSON. This way, any application, regardless of language, can collect and parse the data.




AJAX

AJAX stands for Asynchronous JavaScript and XML. It’s a technique used in web development to create more dynamic and responsive web pages. Here’s how it works:

  1. Asynchronous: AJAX allows communication between the web page and the server without requiring the entire page to reload. This means that specific parts of the page can be updated independently, improving user experience.

  2. JavaScript: AJAX uses JavaScript to make requests to the server and handle responses. When an event occurs (like a button click), JavaScript creates an XMLHttpRequest object to send a request to the server.

  3. XML (or other formats): Although the name suggests XML, AJAX can also use plain text or JSON to exchange data between the client (browser) and the server.

Here’s a simple example of AJAX in action:

Applications Of AJAX

  • One common application of Ajax is in web forms. Instead of submitting the entire form and waiting for a response from the server, Ajax allows the form to be submitted asynchronously. This means that you can continue interacting with the page while the form data is being processed in the background.
  • Another application is in live updates and notifications. With Ajax, websites can fetch new data from the server periodically without requiring the user to refresh the page manually. This is commonly seen in social media feeds, chat applications, and news websites where new content is constantly being addedE-commerce websites also make use of Ajax for things like product filtering and sorting. Instead of reloading the entire page every time a filter or sorting option is applied, Ajax allows the website to fetch and display the updated results instantly, providing a smoother and more seamless shopping experience.

Advantages of AJAX

  • Enhanced Interactivity: AJAX enables developers to create web applications with rich, interactive features that rival traditional desktop applications.
  • Improved Performance: By fetching and updating only the necessary data, AJAX reduces bandwidth usage and server load, leading to faster response times.
  • Reduced Server Load: AJAX minimizes the need for full page reloads, resulting in reduced server load and increased scalability of web applications.
  • Smoother User Experience: With AJAX, web pages can update content seamlessly in the background, providing a smoother and more responsive user experience.

Limitations of AJAX

  • Complexity: Implementing AJAX functionality requires a solid understanding of JavaScript, asynchronous programming, and server-side technologies, which can be challenging for new developers.
  • SEO Challenges: Search engine optimization (SEO) can be challenging for AJAX-powered websites, as search engine crawlers may have difficulty indexing dynamically generated content.
  • Security Risks: AJAX can introduce security vulnerabilities such as cross-site scripting (XSS) and cross-site request forgery (CSRF) if not implemented properly, potentially compromising user data and system integrity.
  • Browser Compatibility: While modern web browsers support AJAX, older browsers may have limited or inconsistent support, requiring developers to implement fallback mechanisms for compatibility.











Comments

Popular posts from this blog

FEB.28, 2024(MARANAN, JAYBEE D.)

MODULE 4_JAYBEE D. MARANAN

Introduction to Database Management