OneClick Waiting Room (Patient)
POST method is used
by grippstick
HTML
<script src="https://rawgit.com/kvz/phpjs/master/functions/xml/utf8_encode.js"></script>
<script src="https://rawgit.com/kvz/phpjs/master/functions/strings/md5.js"></script>
<body>
<button id="launchOneclick">Enter Exam Room</button>
<iframe name="oneclickWidget"></iframe>
</body>
CSS
iframe[name="oneclickWidget"] {
width: 100%;
height: 600px;
}
JavaScript
window.addEventListener('message', function(event) {
alert(event.data);
});
$("body").on("click", "#launchOneclick", function() {
// The following values should be managed by php code
var expiry = Math.round(new Date().getTime() / 1000) + 3600 * 2;
var salt = '12345678';
var token = 1;//md5(expiry + salt);
startOneclickWidget('oneclickWidget', {
url: "https://vsee.me/u/gethealthy",
css: "",
first_name: "Frank",
last_name: "Rizzo",
reason_for_visit: "Broken Neck!",
token: token,
expiry: expiry
});
});
/*
* Demonstrate how to launch oneclick widget with post method
* Input parameters:
* name: (String) The name of iframe
* parameters: (Object) Parameters for oneclick widget
* - url: (String) Waiting room url
* - css: (String) Custom css path
* - first_name: (String) Visitor's first name
* - last_name: (String) Visitor's last name
* - reason_for_visit: (String) Visitor's reason for visiting waiting room
* - token: (String) The token for verifying this request
* - expiry: (String) The timestamp of session expire time
*/
function startOneclickWidget(name, parameters) {
var newform = $('<form></form>');
var first_name_input = $('<input type="text" name="first_name" value="' + parameters["first_name"] + '"></input>');
var last_name_input = $('<input type="text" name="last_name" value="' + parameters["last_name"] + '"></input>');
var reason_for_visit_input = $('<input type="text" name="reason_for_visit" value="' + parameters["reason_for_visit"] + '"></input>');
var expiry_input = $('<input type="text" name="expiry" value="' + parameters["expiry"] + '"></input>');
var token_input = $('<input type="text" name="token" value="' + parameters["token"] + '"></input>');
newform.attr('target', name);
newform.attr('action', parameters["url"] + "?style=" + parameters["css"]);
newform.attr('method', 'POST');
...