[Django]-Django HttpResponseRedirect is not redirecting

3๐Ÿ‘

โœ…

I was using ajax to submit the form and this was causing the problem, I was using below jquery to submit the form with ajax

$("#question_form").on("submit", function(event) {
        event.preventDefault();
        // moving textarea content to hidden content
        // $("#question_hidden").attr('value', $("#id_question").val());
        console.log( $( this ).serialize() );
        $.ajax( {
        type: 'GET',
        url:"http://localhost:8000/q/",
        // data:$('.q_id_c'),
        data:$(this).serialize(),
        success: successQuestionPost,
        dataType: 'html'
        });

});

I removed it and httpredirectresponse works now as expected.

๐Ÿ‘คJaved

Leave a comment