set value by function Success ajax jquery

Asked

Viewed 42 times

0

In the Success function I am not able to set a value of a div with the content of the date variable

$(document).on("click", ".js-busca-previsao-chegada", function(event) {
    event.preventDefault();
    var familia = $(this).attr("js-familia");
    var esferico = $(this).attr("js-esferico");
    var cilindrico = $(this).attr("js-cilindrico");
    $
        .ajax({
            async: false,
            type: "GET",
            url: "/buscaprevisaochegada",
            dataType: 'json',
            data: {
                "familia": familia,
                "esferico": esferico,
                "cilindrico": cilindrico

            },
            success: function(data) {
                $("#js-tooltip-previsao").text(data);
            }
        });
});
  • You have verified what is coming in the date variable?

  • when I place console data nothing appears my problem is rightly Success: Function(data)

  • The problem may be in your url "search prediction of arrival"

  • before it returned a string and not a json made the switch here and now the value passes on the console. Thanks @Wictorchaves

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.