This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let http = require("http") | |
| let app = http.createServer((req, res) => { | |
| if (req.url == "/") { | |
| res.end("Hello World") | |
| } else { | |
| res.end("Page Not Found") | |
| } | |
| }) | |
| app.listen(3000) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <h1>To-Do App</h1> | |
| <form id="form"> | |
| <input id="input" type="text" autocomplete="off"> | |
| <button>Create Item</button> | |
| </form> | |
| <h3>Things To Do</h3> | |
| <ul id="list"></ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| document.getElementById("copyright").innerHTML = | |
| "© " + new Date().getFullYear(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fetch('https://api-to-call.com/endpoint', { | |
| method: 'POST', | |
| body: JSON.stringify({id: '200'}) | |
| }).then(response => { | |
| if (response.ok) { | |
| return response.json(); | |
| } throw new Error('Request failed!'); | |
| }, networkError => console.log(networkError.message) | |
| ).then(jsonResponse => jsonResponse) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fetch('https://api-to-call.com/endpoint').then(response => { | |
| if (response.ok) { | |
| return response.json(); | |
| } throw new Error('Request failed!'); | |
| }, networkError => console.log(networkError.message) | |
| ).then(jsonResponse => jsonResponse); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $.ajax({ | |
| url: 'https://api-to-call.com/endpoint', | |
| type: 'POST', | |
| data: JSON.stringify({id: 200}), | |
| dataType: 'json', | |
| success(response) { | |
| console.log(response); | |
| }, | |
| error(jqXHR, status, errorThrown) { | |
| console.log(jqXHR); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $.ajax({ | |
| url: 'https://api-to-call.com/endpoint', | |
| type: 'GET', | |
| dataType: 'json', | |
| success(response) { | |
| console.log(response); | |
| }, | |
| error(jqXHR, status, errorThrown) { | |
| console.log(jqXHR); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const xhr = new XMLHttpRequest; | |
| const url = 'https://api-to-call.com/endpoint'; | |
| const data = JSON.stringify({id: '200'}); | |
| xhr.responseType = 'json'; | |
| xhr.onreadystatechange = function() { | |
| if (xhr.readyState === XMLHttpRequest.DONE) { | |
| console.log(xhr.response); | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const xhr = new XMLHttpRequest(); | |
| const url = 'https://api-to-call.com/endpoint'; | |
| xhr.responseType = 'json'; | |
| xhr.onreadystatechange = function() { | |
| if (xhr.readyState === XMLHttpRequest.DONE) { | |
| console.log(xhr.response); | |
| } | |
| }; |
NewerOlder