1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-05-31 21:59:42 +02:00
2020-12-26 15:17:20 +00:00

69 lines
2.8 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>Template Web</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
</head>
<body>
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="#">
Template Web
</a>
</div>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-8">
<h1>Template Web</h1>
<form class="example">
<div class="form-group">
<label>Enter your name</label>
<input type=text class="form-control" id="name" name="name" placeholder="John">
</div>
<button class="btn btn-default">Submit</button>
</form>
</div>
</div>
<div class="row">
<div class="col-md-8">
<div class="message"></div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<!-- You may want to store this in a separate file -->
<script type="text/javascript">
$(".example").submit(function(e) {
e.preventDefault();
var url = window.location.href.replace(/\/$/, "") + "/example/call";
var data = $(this).serializeArray()[0];
var name = data.value;
if (name.length == 0) {
name = "John";
};
$.ajax({
method: "POST",
dataType: "json",
contentType: "application/json",
url: url,
data: JSON.stringify({name: name}),
success: function(data) {
$('.message').html('<h3>'+data.msg+'</h3>');
},
});
});
</script>
</body>
</html>