1
0
mirror of synced 2024-11-25 13:16:02 +03:00
mg-transport-telegram/templates/home.html
2018-05-23 17:40:09 +03:00

58 lines
2.2 KiB
HTML

{{template "header"}}
<div class="container">
<div class="row" style="margin-top: 5%">
<form class="col s8 offset-s2" method="POST" id="save-crm" action="/create/">
<p id="msg"></p>
<div class="row">
<div class="input-field col s12">
<input placeholder="API Url" id="api_url" name="api_url" type="text" class="validate">
</div>
</div>
<div class="row">
<div class="input-field col s12">
<input placeholder="API Key" id="api_key" name="api_key" type="text" class="validate">
</div>
</div>
<div class="row">
<div class="input-field col s6 offset-s5">
<button class="btn waves-effect waves-light red lighten-1" type="submit" name="action">
{{.Locale.ButConnect}}
<i class="material-icons right">sync</i>
</button>
</div>
</div>
</form>
</div>
</div>
</body>
<script>
$('#save-crm').on("submit", function(e) {
e.preventDefault();
send($(this).attr('action'), $(this).serialize())
});
function send(url, data) {
$.ajax({
url: url,
data: data,
success: function(res){
console.log(res);
},
error: function (res){
if (res.status < 400) {
if (res.responseText) {
document.location.replace(
location.protocol.concat("//").concat(window.location.host) + res.responseText
);
}
} else {
$('#msg').text(res.responseText);
}
}
});
}
</script>
</html>