Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Demo</title>
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.form/4.3.0/jquery.form.min.js" integrity="sha384-qlmct0AOBiA2VPZkMY3+2WqkHtIQ9lSdAsAn5RUJD/3vA5MKDgSGcdmIv4ycVxyn" crossorigin="anonymous"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script>
$(function() {
var options = {
target: '#roots',
url: "/solve",
type: "post"
};
$('#solve').ajaxForm(options);
});
</script>
</head>
<body>
<div class="container">
<h1>Calling a Rust function in Node.js</h1>
<p class="lead">Solve the Quadratic equation</p>
<form id="solve">
<div class="form-row align-items-center">
<div class="col-auto">
<div class="input-group mb-2">
<input type="text" class="form-control" name="a" placeholder="a">
<div class="input-group-append">
<div class="input-group-text">X^2</div>
</div>
</div>
</div>
<div class="col-auto">
<div class="input-group mb-2">
<div class="input-group-prepend">
<div class="input-group-text">+</div>
</div>
<input type="text" class="form-control" name="b" placeholder="b">
<div class="input-group-append">
<div class="input-group-text">X</div>
</div>
</div>
</div>
<div class="col-auto">
<div class="input-group mb-2">
<div class="input-group-prepend">
<div class="input-group-text">+</div>
</div>
<input type="text" class="form-control" name="c" placeholder="c">
<div class="input-group-append">
<div class="input-group-text">= 0</div>
</div>
</div>
</div>
<div class="col-auto">
<button type="submit" class="btn btn-primary mb-2">Solve</button>
</div>
</div>
</form>
<div class="jumbotron">
<p class="lead">The roots are <span id="roots">not ready</span></p>
</div>
</div> <!-- /container -->
</body>
</html>