File tree Expand file tree Collapse file tree 5 files changed +80
-45
lines changed Expand file tree Collapse file tree 5 files changed +80
-45
lines changed Original file line number Diff line number Diff line change @@ -39,14 +39,21 @@ export class AppComponent implements OnInit {
39
39
}
40
40
41
41
// function saveSurveyResults(url, json) {
42
- // const request = new XMLHttpRequest();
43
- // request.open('POST', url);
44
- // request.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
45
- // request.addEventListener('load', () => {
46
- // // Handle "load"
42
+ // fetch(url, {
43
+ // method: 'POST',
44
+ // headers: {
45
+ // 'Content-Type': 'application/json;charset=UTF-8'
46
+ // },
47
+ // body: JSON.stringify(json)
48
+ // })
49
+ // .then(response => {
50
+ // if (response.ok) {
51
+ // // Handle success
52
+ // } else {
53
+ // // Handle error
54
+ // }
55
+ // })
56
+ // .catch(error => {
57
+ // // Handle error
47
58
// });
48
- // request.addEventListener('error', () => {
49
- // // Handle "error"
50
- // });
51
- // request.send(JSON.stringify(json));
52
59
// }
Original file line number Diff line number Diff line change @@ -30,14 +30,21 @@ $(function() {
30
30
} ) ;
31
31
32
32
// function saveSurveyResults(url, json) {
33
- // const request = new XMLHttpRequest();
34
- // request.open('POST', url);
35
- // request.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
36
- // request.addEventListener('load', () => {
37
- // // Handle "load"
33
+ // fetch(url, {
34
+ // method: 'POST',
35
+ // headers: {
36
+ // 'Content-Type': 'application/json;charset=UTF-8'
37
+ // },
38
+ // body: JSON.stringify(json)
39
+ // })
40
+ // .then(response => {
41
+ // if (response.ok) {
42
+ // // Handle success
43
+ // } else {
44
+ // // Handle error
45
+ // }
46
+ // })
47
+ // .catch(error => {
48
+ // // Handle error
38
49
// });
39
- // request.addEventListener('error', () => {
40
- // // Handle "error"
41
- // });
42
- // request.send(JSON.stringify(json));
43
50
// }
Original file line number Diff line number Diff line change @@ -32,14 +32,21 @@ document.addEventListener("DOMContentLoaded", function() {
32
32
} ) ;
33
33
34
34
// function saveSurveyResults(url, json) {
35
- // const request = new XMLHttpRequest();
36
- // request.open('POST', url);
37
- // request.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
38
- // request.addEventListener('load', () => {
39
- // // Handle "load"
35
+ // fetch(url, {
36
+ // method: 'POST',
37
+ // headers: {
38
+ // 'Content-Type': 'application/json;charset=UTF-8'
39
+ // },
40
+ // body: JSON.stringify(json)
41
+ // })
42
+ // .then(response => {
43
+ // if (response.ok) {
44
+ // // Handle success
45
+ // } else {
46
+ // // Handle error
47
+ // }
48
+ // })
49
+ // .catch(error => {
50
+ // // Handle error
40
51
// });
41
- // request.addEventListener('error', () => {
42
- // // Handle "error"
43
- // });
44
- // request.send(JSON.stringify(json));
45
52
// }
Original file line number Diff line number Diff line change @@ -38,16 +38,23 @@ function App() {
38
38
}
39
39
40
40
// function saveSurveyResults(url, json) {
41
- // const request = new XMLHttpRequest();
42
- // request.open('POST', url);
43
- // request.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
44
- // request.addEventListener('load', () => {
45
- // // Handle "load"
41
+ // fetch(url, {
42
+ // method: 'POST',
43
+ // headers: {
44
+ // 'Content-Type': 'application/json;charset=UTF-8'
45
+ // },
46
+ // body: JSON.stringify(json)
47
+ // })
48
+ // .then(response => {
49
+ // if (response.ok) {
50
+ // // Handle success
51
+ // } else {
52
+ // // Handle error
53
+ // }
54
+ // })
55
+ // .catch(error => {
56
+ // // Handle error
46
57
// });
47
- // request.addEventListener('error', () => {
48
- // // Handle "error"
49
- // });
50
- // request.send(JSON.stringify(json));
51
58
// }
52
59
53
60
export default App ;
Original file line number Diff line number Diff line change @@ -50,15 +50,22 @@ export default {
50
50
}
51
51
52
52
// function saveSurveyResults(url, json) {
53
- // const request = new XMLHttpRequest();
54
- // request.open('POST', url);
55
- // request.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
56
- // request.addEventListener('load', () => {
57
- // // Handle "load"
53
+ // fetch(url, {
54
+ // method: 'POST',
55
+ // headers: {
56
+ // 'Content-Type': 'application/json;charset=UTF-8'
57
+ // },
58
+ // body: JSON.stringify(json)
59
+ // })
60
+ // .then(response => {
61
+ // if (response.ok) {
62
+ // // Handle success
63
+ // } else {
64
+ // // Handle error
65
+ // }
66
+ // })
67
+ // .catch(error => {
68
+ // // Handle error
58
69
// });
59
- // request.addEventListener('error', () => {
60
- // // Handle "error"
61
- // });
62
- // request.send(JSON.stringify(json));
63
70
// }
64
71
</script >
You can’t perform that action at this time.
0 commit comments