Here error i can not detect. here i am retrieving xml data in html page in table form by Ajax         Perfume Data                      id    Product name    Brand    Ingredients    Item weight                     XML FILE is like this               p1         Calvin Klein Beauty Eau de Parfum for Women, 100ml         39.99         Calvin Klein         Alcohol Denat, Water, Parfum         1 Pounds                 p2         Burberry London Fabric Eau De Parfum, 100ml         49.99         BURBERRY         Alcohol Denat, Water, Parfum.         100 Grams

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Here error i can not detect. here i am retrieving xml data in html page in table form by Ajax 
 
<!doctype html>
<html>

 

<head>

 

 <title>Perfume Data</title>
 <script src="https://code.jquery.com/jquery-3.5.1.js">
 </script>
 <style>
  table {
            margin: 0 auto;
            font-size: large;
            border: 1px solid black;
        }
 

 

  th {
    font-weight: bold;
            border: 1px solid black;
            padding: 10px;
            text-align: center;
  }

 

  td {
            padding: 10px;
            text-align: center;
            font-weight: lighter;
            background-color: #E4F5D4;
            border: 1px solid black;
  }
 </style>

 

 

 

</head>

 

<body>

 

 <table id="myTableData">
  <tr>
   <th>id</th>
   <th>Product name</th>
   <th>Brand</th>
   <th>Ingredients</th>
   <th>Item weight</th>

 

  </tr>

 

 

 

  <script>
   $(document).ready(function () {

 

    // FETCHING DATA FROM JSON FILE
    $.getJSON("Perfume.XML",
     function (data) {
      var student = '';

 

      // ITERATING THROUGH OBJECTS
      $.each(data, function (key, value) {
       // console.log("v", value)
       //CONSTRUCTION OF ROWS HAVING
       // DATA FROM JSON OBJECT
       value.map(e => {

 

        var res = student += '<tr>'
        student += '<td>' +
         e.id + '</td>'

 

        student += '<td>' +
         e.["Product name"] + '</td>'

 

        student += '<td>' +
         e.Brand + '</td>'

 

        student += '<td>' +
         e.Ingredients + '</td>'

 

        student += '<td>' +
         e.["Item weight"] + '</td>'



        student += '</tr>'
        return res

 

       })

 

      })

 

      //INSERTING ROWS INTO TABLE
      $('#myTableData').append(student)
     })
   })
  </script>

 

</body>

 

</html>
 
 
XML FILE is like this
 
<?xml version="1.0" encoding="UTF-8" ?>
    <Perfume>
        <id>p1</id>
        <Product name>Calvin Klein Beauty Eau de Parfum for Women, 100ml</Product name>
        <Price>39.99</Price>
        <Brand>Calvin Klein</Brand>
        <Ingredients>Alcohol Denat, Water, Parfum</Ingredients>
        <Item weight>1 Pounds</Item weight>
    </Perfume>
    <Perfume>
        <id>p2</id>
        <Product name>Burberry London Fabric Eau De Parfum, 100ml</Product name>
        <Price>49.99</Price>
        <Brand>BURBERRY</Brand>
        <Ingredients>Alcohol Denat, Water, Parfum.</Ingredients>
        <Item weight>100 Grams</Item weight>
    </Perfume>
 
 
Expert Solution
Overview

In this question we have to write a code for HTML/AJAX and XML data to present on the table in HTML.

Let's code

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Features of HTML
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education