Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Convert an Ajax application from XML to JSON. In this exercise, youwill modify anAjax application so that it uses a JSON file instead of an

Convert an Ajax application from XML to JSON. In this exercise, youwill modify anAjax application so that it uses a JSON file instead of an XML file. The web page for this application should remain the same as it was when the XML file was used:

image text in transcribed

Modify the $.ajax method so that it gets the data instead from the JSON file instead of the XML file.

You will also find a file named team.json that should be used for the Ajax request instead of the file named team.xml.

/****************CODES***************************/

INDEX.HTML

XML to JSON

$(document).ready(function() {

$.ajax({

type: "get",

url: "team.xml",

beforeSend: function() {

$("#team").html("Loading...");

},

timeout: 10000,

error: function(xhr, status, error) {

alert("Error: " + xhr.status + " - " + error);

},

dataType: "xml",

success: function(data) {

$("#team").html("");

$(data).find("management").children().each(function() {

var xmlDoc = $(this);

$("#team").append("

" +

xmlDoc.find("name").text() + "" +

xmlDoc.find("title").text() + " " +

xmlDoc.find("bio").text() + " ");

});

}

});

});

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions