0
I would like to pass a (or more) variable to the Springmvc controller
login.html
<form id="form-login" method="post">
<div class="log-input">
<div class="log-input-left">
<input type="text" id="usuario" class="user" onblur="buscar()" placeholder="Usuário"/>
</div>
</div>
<div class="log-input">
<div class="log-input-left">
<input type="password" class="lock" value="password" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Email address:';}"/>
</div>
</div>
<div class="log-input">
<div class="log-input-left">
<input type="text" class="empresa" value="Empresa" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Email address:';}"/>
</div>
</div>
<button class="btn btn-acessar">Acessar o Sistema</button>
</form>
acaologin.js
function buscar(){
alert('Salvar');
var nome = document.getElementById("usuario").value;
jQuery.ajax({
type: 'POST',
url: 'empresa',
dataType: 'json',
data: {
usuario : nome
},
success: function(data){
alert(data.response);
}
});
}
Controller
@Requestmapping("/company")
public @ResponseBody String empresa (@RequestParam(value = "usuario") String usuario){
Usuario_Controller uc = new Usuario_Controller();
JOptionPane.showMessageDialog(null, "Empresa");
String empre = uc.recuperarEmpresa(usuario);
return "{\"response\" : \""+empre+"\"}";
}
But when trying to get information, analyzing Chrome’s Debugger it shows this message:
Provisional headers are shown