items.js - AWS Code Sample

items.js

$(function() { $('#myTable').DataTable( { scrollY: "500px", scrollX: true, scrollCollapse: true, paging: true, columnDefs: [ { width: 200, targets: 0 } ], fixedColumns: true } ); } ); function getImages() { var xhr = new XMLHttpRequest(); xhr.addEventListener("load", handleimages, false); xhr.open("GET", "../getimages", true); //buildFormit -- a Spring MVC controller xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");//necessary xhr.send(); } function handleimages() { var xml = event.target.responseText; var oTable = $('#myTable').dataTable(); oTable.fnClearTable(true); $(xml).find('Item').each(function () { var $field = $(this); var key = $field.find('Key').text(); var name = $field.find('Owner').text(); var date = $field.find('Date').text(); var size = $field.find('Size').text(); //Set the new data oTable.fnAddData( [ key, name, date, size,,] ); }); }