[Answer]-Django 1.5 loses data from a form

1👍

here’s your problem: you call console.log in the beginning so you can really see that $("#email").val() exists, but THEN you remove email input by calling that $('#getemailbutton').html(ending). So in the end, when $.post() is called, $("#email") doesn’t exist anymore.
Save that value into some variable, which you can use later:

function getemail(){
    div = 'getemailbutton';
    ending="Thanks! We will contact you asap.";
    console.log($('#email').val());
    var email = $('#email').val()'
    $('span#getemailbutton').css('display','none');
    $('#getemailbutton').html(ending).fadeIn();
    $.post("/getemail/",{ "email" : email });
}

Leave a comment