1
0
mirror of synced 2024-11-22 20:36:01 +03:00
mg-transport-telegram/templates/home.html

58 lines
2.2 KiB
HTML
Raw Normal View History

2018-05-18 18:11:09 +03:00
{{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">
2018-05-18 18:11:09 +03:00
<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 {
2018-05-18 18:11:09 +03:00
$('#msg').text(res.responseText);
}
}
});
}
</script>
</html>