Advertisement
Guest User

ajax

a guest
Feb 27th, 2019
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. $(document).ready(function() {
  2. tampil_data();
  3. function tampil_data() {
  4. $.ajax({
  5. type: 'ajax',
  6. url : '<?=base_url()?>dashboard/calendar',
  7. async : true,
  8. method: "POST",
  9. dataType : 'json',
  10. contentType: "application/json",
  11. success : function(data){
  12. var html = '';
  13. html1 = '';
  14. bulan = data.bulan_tahun;
  15. clc_format = {};
  16. week = {};
  17. day = {};
  18. for (i = 0; i < data.clc_format.length; i++) {
  19. clc_format[i] = data.clc_format[i];
  20. week[i] = data.hari[(i+1)];
  21. var total_day = Object.keys(week[i]).length;
  22. html += `<tr>`+
  23. `<td><input type="text" class="form-control text-center" name="dayofweek`+i+`" value="`+clc_format[i]+`"></td>`+
  24. // `<td class="text-center">`+week[i][1]+`</td>`+
  25. for (j = 1; j <= total_day; j++) {
  26. var dataHari = week[i][j];
  27. // if (dataHari == 0) {
  28. // dataHari = ""
  29. // }
  30. html1 += j;
  31. console.log(html1);
  32. }
  33. `</tr>`;
  34.  
  35. }
  36. // $('#table').html(html);
  37. document.getElementById("table").innerHTML = html;
  38. document.getElementById("bulan").innerText = bulan;
  39. // $('#days').append(html1);
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement