Guest User

Untitled

a guest
Jun 20th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. {
  2. "main_object": {
  3. "id": "0",
  4. "getExerciseTitle": "TestToConfirm",
  5. "language": "nl_NL",
  6. "application": "lettergrepen",
  7. "main_object": {
  8. "title": "TestToConfirm",
  9. "language": "nl_NL",
  10. "exercises": [
  11. {
  12. "word": "huisarts",
  13. "syllables": [
  14. "huis",
  15. "arts"
  16. ]
  17. },
  18. {
  19. "word": "huisartsenpraktijk",
  20. "syllables": [
  21. "huis",
  22. "artsen",
  23. "praktijk"
  24. ]
  25. },
  26. {
  27. "word": "testikels",
  28. "syllables": [
  29. "test",
  30. "ikels"
  31. ]
  32. },
  33. {
  34. "word": "Graag gedaan. v",
  35. "syllables": [
  36. "graag",
  37. "gedaan"
  38. ]
  39. }
  40. ]
  41. },
  42. "dataType": "json"
  43. }
  44. }
  45.  
  46. function createExercise(json) {
  47. const exercises = json.main_object.main_object.exercises;
  48. exercises.forEach(function(exercise) {
  49. var exer = $('<div/>', {
  50. 'class': 'row'
  51. })
  52. .append(
  53. $('<div/>', {
  54. 'class': 'col-md-3'
  55. })
  56. .append(
  57. $('<div/>', {
  58. 'class': 'row'
  59. })
  60. .append($('<div>', {
  61. class: 'col-md-3 audioButton'
  62. }))
  63. .append($('<div>', {
  64. class: 'col-md-9 ExerciseWordFontSize exerciseWord',
  65. 'id': 'wordInput[' + ID123 + ']',
  66. text: exercise.word
  67. }))
  68. )
  69. ).append(
  70. $('<div>', {
  71. class: 'col-md-9'
  72. })
  73. .append(
  74. $('<div/>', {
  75. class: 'row'
  76. }))
  77. .append($('<div/>', {
  78. class: 'col-md-3 inputSyllables'
  79. }))
  80. );
  81.  
  82. $("#exerciseField").append(exer);
  83. ID123++;
  84. exer.find('.audioButton').append(getAudioForWords());
  85.  
  86. });
  87.  
  88. exercises.forEach(function(exercise) {
  89. lengthsyllables = exercise.syllables.length;
  90. console.log(lengthsyllables);
  91. for (l = 0; l < lengthsyllables; l++) {
  92. var getInputField = $('<input/>', {
  93. 'type': 'text',
  94. 'class': 'form-group form-control col-md-3',
  95. 'name': 'inputSyllables'
  96. });
  97. $('.inputSyllables').append(getInputField);
  98. }
  99. });
  100. }
Add Comment
Please, Sign In to add comment