Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sendToMid(username, password) {
- console.log(JSON.stringify({ucid: username, pass: password}))
- const form = document.getElementById('login-form');
- console.log("send data");
- fetch('my apis url', {
- method: 'post',
- //mode: "same-origin",
- //credentials: "same-origin",
- headers: {
- //'Access-Control-Allow-Origin': 'https://web.njit.edu/~md537/mid.php',
- 'Accept': 'application/json',// text/plain, */*',
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify({ucid: username, pass: password})
- }).then(function(response) {
- // console.log(response.json());
- return response.json();
- }).then(function(jsonresponse) {
- console.log(jsonresponse);
- console.log("thats all folks");
- console.log(jsonresponse.json());
- });
- console.log("finished executing");
- }//sendToMid
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement