$(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); } }); }); });