add script for display result from server
This commit is contained in:
18
script.js
Normal file
18
script.js
Normal file
@@ -0,0 +1,18 @@
|
||||
$(document).ready(function() {
|
||||
$('form').on('submit', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var operandA = $('input[name="operandA"]').val();
|
||||
var operandB = $('input[name="operandB"]').val();
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'http://webex.sdi.hevs.ch/calc',
|
||||
data: { operandA: operandA, operandB: operandB },
|
||||
success: function(data) {
|
||||
var result = $(data).find('strong').text();
|
||||
$('input[name="result"]').val(result);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user