getEvents.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. var getEditableEvents = function() {
  2. $.get('getevents.php', {}, function(response) {
  3. var events = "";
  4. var i = 0;
  5. for (i = 0; i < response.length; i++) {
  6. events += '<form method="post" action="saveevents.php?eventid='+response[i].eventid+'"><div><ul>';
  7. events += '<li class="event"><input type="text" name="title" value="' + response[i].title + '" /></li>';
  8. events += '<li class="event"><input type="text" name="date" value="' + response[i].startdate + '" /></li>';
  9. events += '<li class="event"><input type="text" name="time" value="' + response[i].starttime + '" /></li>';
  10. /*events += '<li class="event"><textarea name="description">' + response[i].description + '</textarea></li>';*/
  11. events += '<li class="event"><input type="text" name="location" value="' + response[i].location + '" /></li>';
  12. events += '<li class="event"><input type="submit" name="save" value="Save" /></li>';
  13. events += '<li class="event"><input type="submit" name="delete" value="Delete" /></li>';
  14. events += "</ul></div></form>";
  15. }
  16. $('#events').html(events);
  17. }, 'json');
  18. };
  19. var getEvents = function() {
  20. $.get('ajax/getevents.php', {}, function(response) {
  21. var events = "<tr><th>Date</th><th>Time</th><th>Event</th><th>Location</th></tr>";
  22. var i = 0;
  23. for (i = 0; i < response.length; i++) {
  24. events += '<tr class="'+response[i].month+'">';
  25. events += '<td>' + response[i].displaydate + '</td>';
  26. events += '<td>' + response[i].displaytime + '</td>';
  27. /*events += '<td>' + response[i].description + '</td>';*/
  28. events += '<td>' + response[i].title + '</td>';
  29. events += '<td>' + response[i].location + '</td>';
  30. events += '</tr>';
  31. }
  32. $('#events').html('<table>' + events + '</table>');
  33. }, 'json');
  34. };