sharing in progress

This commit is contained in:
Your Name 2019-04-18 20:47:24 -07:00
parent 416d975685
commit 01fba58718
2 changed files with 24 additions and 14 deletions

View File

@ -3,23 +3,33 @@ function enable_sharing() {
let name = $("#share_name").val()
let email = $("#share_email").val()
if (name && email) {
$.post("https://gradio.app/send_email", {
"url": config["ngrok_socket_url"],
"name": name,
"email": email
}).done(function() {
$("#share_message").text("Shared successfully.");
}).fail(function() {
$("#share_message").text("Failed to share.");
}).always(function() {
$("#share_form").hide();
$("#share_complete").show();
});
$.ajax({
"url" : "https://gradio.app/send_email",
"type": "POST",
"crossDomain": true,
"data": JSON.stringify({
"url": config["ngrok_socket_url"],
"name": name,
"email": email
}),
"success": function() {
$("#share_message").text("Shared successfully.");
$("#share_more").text("Share more");
},
"error": function() {
$("#share_message").text("Failed to share.");
$("#share_more").text("Try again");
},
"complete": function() {
$("#share_form").hide();
$("#share_complete").show();
}
})
}
})
}
$("#share_more").click(function (evt) {
$("#share_form").show();
$("#share_complete").hide();
$("#share_complete").hide();
})

View File

@ -32,7 +32,7 @@
</div>
<div id="share_complete">
<span id="share_message"></span>
<button class="secondary" id="share_more">Share more</button>
<button class="secondary" id="share_more"></button>
</div>
</div>
<div id="panels">