DziennikOcen/public/xml.js
2022-01-31 22:23:46 +01:00

32 lines
1.1 KiB
JavaScript

function ajaxCall()
{
$(document).ready(function() {
$('#bt').click(function () {
$('#books').empty(); // Clear the DIV.
$.ajax({
type: 'GET',
url: 'sprawdziany/testy.xml', // The file path.
dataType: 'xml',
success: function(xml) {
$(xml).find('List').each(function() {
// Append new data to the DIV element.
$('#books').append(
'<div>' +
'<div><b>Nazwa sprawdzianu: </b>' +
$(this).find('Sprawdzian').text() + '</div> ' +
'<div><b>Godzina i data: </b>' +
$(this).find('Godz').text() + '</div> ' +
'<div><b>Miejsce: </b>' +
$(this).find('Klasa').text() + '</div> ' +
'</div>');
});
}
});
});
});
}