Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script >
- var webresource = "<%= getServletContext().getContextPath()%>/webresources";
- var calculadoraRest = webresource + "/calculadora";
- var factorialPath = calculadoraRest + "/factorial";
- function getAuthPairs() {
- var usr = {
- user: $("#usuario").val(),
- password: $("#contrasenia").val()
- };
- return usr;
- }
- function init() {
- $("#factorialBtn").click(function() { //definiendo el evento click del boton #factorialBtn
- var auth = getAuthPairs();
- var vBase = $("#f_base").val(); //obteniendo el valor del input #f_base
- $.ajax(factorialPath,
- {data: {base: vBase},
- username: auth.user,
- password: auth.password,
- success: function(resp) { //llamando al webservice con el parametro base igual a la variable base
- $("#f_resultado").text("Resultado:" + resp); //... muestra el resultado obtenido en resp en el div
- }
- });
- });
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement