im trying to submit a form on ajax success under if-else statement but it is not working i dont understand why? see the code below
$.ajax({
            type: "POST",
            url:'<?php echo base_url() ?>signup/order_validations',
            data:$("#orderform").serialize(),
            dataType: 'json',
            success: function (data) {
                if(data.length > 0){
                    $(".err").html(data);
                    $(".err").show();
                    $('html, body').animate({scrollTop: $(".progras-bar-area").offset().top}, 800);
                }else{
                    $("#orderform").submit();
                }
            },
            error:function(){
              $(".err").html("Something went wrong...Please try again."); 
            }
        });
 
     
     
    