Question: I am fairly new to using javascript, jquery and ajax and have a question on how I would load xml data and json data from

I am fairly new to using javascript, jquery and ajax and have a question on how I would load xml data and json data from a server using javascript and jquery. I have this so far:

$.(document).ready(function(){ $.ajax({ type: "GET", url: "http://ec2-34-226-140-164.compute-1.amazonaws.com/PublicChallenges/Challenge9/webService.php?content=data&format=xml", dataType: "xml", success: xmlParser }); $.getJSON("ec2-34-226-140-164.compute-1.amazonaws.com/PublicChallenges/Challenge9/webService.php?content=data&format=json", function(data){ var pokeData = ''; $.each(data, function(key, value){ pokeData += '

    ' + value.name + " has growth" + value.growth + '

'; }); $("#pokeScreen").append(pokeData); }); }); function xmlParser(xml){ $(xml).find("pokemon").each(function(){ $("#pokeScreen").append('
    ' + $.(this).find("name").text() + $.(this).find("type").text() + '

'); }); }

I also have buttons that load either the xml or json when clicked and the data appears on a div

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!