I need assistance with this question: chapter 8 Requirements: Based on examples
ID: 3600274 • Letter: I
Question
I need assistance with this question:
chapter 8
Requirements: Based on examples on AJAX and JASON in this chapter (all the code of this example can be downloaded from the book site as usual), write an HTML with JavaScript (and probably image files or CSS) that display the content of the attached XML file (computers.xml). The javascript should not try to access any files other than the supplied XML file. The webpage should be well formatted for easy reading (5 Points). Note that you need to use AJAX and JSON as shown in this chapter. No point given if using other methods.
computers.xml is listed below:
Note that you need to use AJAX and JSON as shown in this chapter.
Windows 8 c7 Chromebook Laptop Kmanufacturer Samsung/manufacturer> Koperating_system>Chrome OS K/computer> Pavillion Slimline Desktop HPWindows 8Jackal 1U Server System76 Koperating system>Ubuntu K/computer> Power 710 Express type>Server AIX /computer_listExplanation / Answer
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$("#upload").bind("click", function () {
var regex = /^([a-zA-Z0-9s_\.-:])+(.xml)$/;
if (regex.test($("#fileUpload").val().toLowerCase())) {
if (typeof (FileReader) != "undefined") {
var reader = new FileReader();
reader.onload = function (e) {
$("#txtXml").val(e.target.result);
}
reader.readAsText($("#fileUpload")[0].files[0]);
} else {
alert("This browser does not support HTML5.");
}
} else {
alert("Please upload a valid XML file.");
}
});
});
</script>
<input type="file" id="fileUpload" />
<input type="button" id="upload" value="Upload" />
<hr />
<textarea id="txtXml" rows="25" cols="40" readonly="readonly"></textarea>
</body>
</html>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.