Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Jquery to get XML and put into html table
- <aside id="shows"class="aside shadow">
- <div class="text" id="table">
- <div class="more low"> MORE SHOWS </div>
- <div class="less"> LESS SHOWS </div>
- </div>
- </aside>
- function showData() {
- $.ajax({
- type: "GET",
- url: "shows.xml",
- dataType: "xml",
- success: function getShows(a) {
- $('#table').append('<h2>SHOWS</h2>');
- $('#table').append('<table>');
- $(a).find('show').each(function(){
- var $show = $(this);
- var date = $show.find('date').text();
- var place = $show.find('place').text();
- var location = $show.find('location').text();
- var time = $show.find('time').text();
- var html = '<tr><td class="bold">' + date + '</td><td class="hide">' + place + '</td><td>' + location + '</td><td class="bold">' + time + '</td></tr></table>';
- $('<table>').append(html);
- });
- }
- });
- }
- <shows>
- <show>
- <date>9/8</date>
- <place>Toads Place</place>
- <location>New Haven, CT</location>
- <time>9PM</time>
- </show>
- </shows>
- url: "shows.xml",
- $.ajax({
- type: "GET",
- url: "shows.xml",
- dataType: "xml",
- success: function(xml){
- $('#table').append('<h2>SHOWS</h2>');
- $('#table').append('<table id="show_table">');
- $(xml).find('show').each(function(){
- var $show = $(this);
- var date = $show.find('date').text();
- var place = $show.find('place').text();
- var location = $show.find('location').text();
- var time = $show.find('time').text();
- var html = '<tr><td class="bold">' + date + '</td><td class="hide">' + place + '</td><td>' + location + '</td><td class="bold">' + time + '</td></tr>';
- $('#show_table').append(html);
- });
- }
- });
Add Comment
Please, Sign In to add comment