Last active
December 21, 2017 12:26
-
-
Save tjunussov/1d82a15533f17d775961af2533b77f63 to your computer and use it in GitHub Desktop.
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
////////////// HTML - CONSOLE.log /////// | |
<pre id="log"></pre> | |
(function () { | |
var _log = console.log; | |
var logger = document.getElementById("log"); | |
console.log = function (message) { | |
if (typeof message == "object") { | |
logger.innerHTML += (JSON && JSON.stringify ? JSON.stringify(message) : message) + "\n"; | |
} else { | |
logger.innerHTML += message + "\n"; | |
} | |
// logger.innerHTML += JSON.stringify(arguments) + "\n"; or simpler | |
_log.apply(console, arguments); | |
} | |
})(); | |
/*********** PROMISE FETCH FORM DATA + OWA**************/ | |
function test(){ | |
var formData = new URLSearchParams(); | |
formData.set("p_skey", _SKEY); | |
formData.set("p_id", id); | |
formData.set("p_store", store); | |
formData.set("p_finger_1", finger); | |
return fetch("https://fingerprint_skud.enrollFinger",{ | |
credentials: 'include', //pass cookies, for authentication | |
method: 'post', | |
headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'}, | |
body: formData | |
}) | |
.then((response)=>{ | |
return response.json() | |
}).then((data)=>{ | |
if(data.result == "error") { | |
return Promise.reject(data.message) | |
} else { | |
return data | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment