I'm trying to run a function that will send data from a form to a server and will give a response to the user in a popup with CSS styles.
I'm not able to display this popup with the result.
<script type="text/javascript">
function simulacao(nome, email, qtdMeses, vlrAluguel){
$.ajax({
url: url + "/api/simulacao",
type: "POST",
data: {nome, email, qtdMeses, vlrAluguel},
dataType: "json",
cache: false,
success: function (data) {
if(data.Status == "ok"){
$('#vlrSimulacao').text("Você pode receber até R$ " + data.Result);
}
}
});
}
$(function(){
$("#nf-field-2").click(function(){
if($("[name='nome']").val() != ""
&& $("[name='email']").val() != ""
&& $("[name='nf-field-5']").val() != ""
&& $("[name='nf-field-4']").val() != ""){
simulacao($("[name='nome']").val(), $("[name='email']").val(), $("[name='nf-field-5']").val(), $("[name='nf-field-4']").val());
}
});
});