Q:

After every alert page refreshes it should not refresh to stop refresh i used prevent default working fine in chrome but not in firefox

Event . prevent default work in chrome but not working in firefox i have tried both methods but is not  working i have searched for all the possible solutions but it didn't work.
If you want me to post all of my code i'll post it if you didn't found error. 
function validate_calc(e){
    event.preventDefault();

function validate_calc(event){
event.preventDefault();

if ($('input[name=water]:checked').length > 0) {

    var $radio = $('input[name=water]:checked');
    var id = $radio.attr('id');
    if(id == 'water'){
    if($('input[name=rad_waters]:checked').length > 0){
        if($('input[name=water_types]:checked').length > 0){
            $value = jQuery.trim($(".cal_input").val());
            if($value == ""){
            alert('Please Insert Values');
            return;
            } else {
                if($.isNumeric($(".cal_input").val())){
                var form_data = {
                 length: $('input[name="length"]').val(),
                 width: $('input[name="width"]').val(),
                    };

                    jQuery.ajax({
                    type        : "POST",
                    data        : form_data,
                    url         : baseurl+'solar_calculator/calculate_area',
                    success     : function(msg){
                    alert(msg);return;  
                    }
                    });
                }else{
                    alert('Value should be in Numbers.');
                    return;
                   }
            }
        }else{
            alert('Select a Sub water type');
            return;
        }
        }else{
        alert('Select a water type.');
        return;
        }
    } else {
    $value = jQuery.trim($(".cal_input").val());
            if($value == ""){
            alert('Please Insert Values');
            return;
            } else {
                if($.isNumeric($(".cal_input").val())){
                    var form_data = {
                 length: $('input[name="length"]').val(),
                 width: $('input[name="width"]').val(),
                    };
                    jQuery.ajax({
                    type        : "POST",
                    data        : form_data,
                    url         : baseurl+'solar_calculator/calculate_area',
                    success     : function(msg){
                    alert(msg);return;  
                    }
                    });
                }else{
                    alert('Value should be in Numbers.');
                    return;
                   }
            }
    }
    } else {
alert('Please Select a water type');
return;
}
}

or i use this method it even didn't work
function validate_calc(e){
    e.preventDefault();

..........

A:

Event - event prevent default don't work on function.
do it with id 
as 
$('#myid').click(function(event){
event.preventDefault;
alert('am i working....'); return
})

